Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I use a greater than or less than symbol with a python script embedded in xml?
    text
    copied!<p>I am using edX Studio to make a course. I would like to make a custom python evaluated input problem. There seems to be an issue with the xml tags being closed by <code>&gt;</code> or <code>&lt;</code> symbols within the python code in the tag? </p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;problem&gt; &lt;p&gt;Name as many online learning platforms as you can: &lt;/p&gt; &lt;script type="loncapa/python"&gt; def make_a_list(name_string): return name_string.split(',') def count_names(name_list): return len(name_list) def how_many_oli(expect, ans): oli_names = ['udacity', 'udemy', 'codecademy', 'iktel' 'codeschool', 'khan academy', 'khanacademy', 'coursera', 'edx', 'iversity'] names = make_a_list(ans) how_many = len(set(names)) message_hint = 'Good work!' for e in names: e=e.strip('"') e=e.strip("'") e=e.strip() e=e.lower() who_is = e if e not in oli_names: message_hint = message_hint+" Tell us about "+str(who_is).title()+"?" if how_many &lt; 1: return { 'ok': False, 'msg': 'None at all?'} if how_many &lt; 5: return { 'ok': True, 'msg': 'Only '+str(how_many)+"?"} if how_many == 5: return { 'ok': True, 'msg': message_hint } if how_many &gt; 5: return { 'ok': True, 'msg': message_hint } return False &lt;/script&gt; &lt;customresponse cfn="how_many_oli"&gt; &lt;textline size="100" /&gt; &lt;/customresponse&gt; &lt;/problem&gt; </code></pre> <p>How do I avoid this? I know I could change the code to avoid using <code>&lt;</code> and <code>&gt;</code> but there must be a way to use them or something similar?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload