Advertisement
eduardoperezl

Plantilla de Problema Adaptativo XML

Sep 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.36 KB | None | 0 0
  1. <problem>
  2.   <text>
  3.     <p>
  4.       <h4>Problema Con Consejo Adaptativo</h4>
  5.     </p>
  6.     <p>
  7. Este Problema demuestra una pregunta con consejos, basados usando el método <tt class="tt">hintfn</tt>.</p>
  8.     <script type="text/python" system_path="python_lib">
  9. def test_str(expect, ans):
  10.   print expect, ans
  11.   ans = ans.strip("'")
  12.   ans = ans.strip('"')
  13.   return expect == ans.lower()
  14.  
  15. def hint_fn(answer_ids, student_answers, new_cmap, old_cmap):
  16.   aid = answer_ids[0]
  17.   ans = str(student_answers[aid]).lower()
  18.   print 'hint_fn called, ans=', ans
  19.   hint = ''
  20.   if 'java' in ans:
  21.      hint = 'ese es bueno solo para beber'
  22.   elif 'perl' in ans:
  23.      hint = 'no ese rico'
  24.   elif 'pascal' in ans:
  25.      hint = 'ese es un lenguaje bohemio'
  26.   elif 'fortran' in ans:
  27.      hint = 'esos fueron buenos días'
  28.   elif 'clu' in ans:
  29.      hint = 'debes ser invariante'
  30.   if hint:
  31.     hint = "&lt;font color='blue'&gt;Hint: {0}&lt;/font&gt;".format(hint)
  32.     new_cmap.set_hint_and_mode(aid,hint,'always')
  33. </script>
  34.     <label>
  35. ¿Cuál es el mejor lenguaje de programación que existe hoy en día? Puedes ingrear la respuesta en mayúsculas o minúsculas, con o sin comillas.
  36.       <customresponse cfn="test_str" expect="python">
  37.         <textline correct_answer="python"/>
  38.         <hintgroup hintfn="hint_fn"/>
  39.       </customresponse>
  40.     </label>
  41.   </text>
  42. </problem>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement