我正在使用 edX Studio 制作课程。我想做一个自定义的 python 评估输入问题。>
xml标签被关闭或标签<
中python代码中的符号 似乎存在问题?
<?xml version="1.0"?>
<problem>
<p>Name as many online learning platforms as you can: </p>
<script type="loncapa/python">
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 < 1:
return { 'ok': False, 'msg': 'None at all?'}
if how_many < 5:
return { 'ok': True, 'msg': 'Only '+str(how_many)+"?"}
if how_many == 5:
return { 'ok': True, 'msg': message_hint }
if how_many > 5:
return { 'ok': True, 'msg': message_hint }
return False
</script>
<customresponse cfn="how_many_oli">
<textline size="100" />
</customresponse>
</problem>
我该如何避免这种情况?我知道我可以更改代码以避免使用<
,>
但必须有一种方法来使用它们或类似的东西?