1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<exercise name = "Hello Name">
<desc>You need to write <b>Hello</b> and then your name, using the variable 'name'.</desc>
<include>
<![CDATA[
import re
def alphabetic(x):
if re.match(r'^[A-Za-z ]+$', x):
return "True"
return "False"
]]>
</include>
<partial>
<![CDATA[
print "Hello <need to print the variable name>."
]]>
</partial>
<solution>
<![CDATA[
# Sample solution, used to generate test output
greeting = "Hello"
print " ".join([greeting, name])
]]>
</solution>
<!-- Alternatively, <solution src="all_input_test_soln.py" /> -->
<case name=""Hello Alice"">
<!-- Specify input -->
<var name="name" value="'Alice'" />
<function desc="Match case insensitive" default="ignore">
<stdout>str.lower</stdout>
</function>
<function desc="Ensure name is alphabetic" default="ignore">
<stdout type="norm">alphabetic</stdout>
</function>
<!-- Ensures that all outputs match exactly -->
<function desc="Match exactly" default="match"/>
</case>
<case name=""Hello Bob"">
<!-- Specify input -->
<var name="name" value="'Bob'" />
<function desc="Match case insensitive" default="ignore">
<stdout type="check">str.__eq__</stdout>
</function>
<function desc="Match exactly" default="ignore">
<stdout/>
</function>
</case>
</exercise>
|