Advertisement
eduardoperezl

Ejemplo de Entrada Evaluada con Python

Sep 13th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.03 KB | None | 0 0
  1. <problem>
  2.  
  3. <script type="loncapa/python">
  4.  
  5. def test_add(expect, ans):
  6.     try:
  7.         a1=int(ans[0])
  8.         a2=int(ans[1])
  9.         return (a1+a2) == int(expect)
  10.     except ValueError:
  11.         return False
  12.  
  13. def test_add_to_ten(expect, ans):
  14.     return test_add(10, ans)
  15.  
  16. </script>
  17.  
  18. <p>Enter two integers that sum to 10. </p>
  19. <customresponse cfn="test_add_to_ten">
  20.   <textline size="10"/><br/>
  21.   <textline size="10"/>
  22. </customresponse>
  23.  
  24. <p>Enter two integers that sum to 20: </p>
  25. <customresponse cfn="test_add" expect="20">
  26.   <textline size="40" correct_answer="11" label="Integer #1"/><br/>
  27.   <textline size="40" correct_answer="9" label="Integer #2"/>
  28. </customresponse>
  29.  
  30. <solution>
  31.   <div class="detailed-solution">
  32.     <p>Explicación</p>
  33.     <p>Cualquier conjunto de enteros en la línea \(y = 10 - x\)  y  \(y = 20 - x\)
  34.        satisface estas restriciones.</p>
  35.     <p>También se pueden agregar imágenes. Por ejemplo:</p>
  36.     <img width="100%" src="/static/explicacion.png"/>
  37.   </div>
  38. </solution>
  39.  
  40. </problem>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement