Skip to content

Commit 2119b10

Browse files
[Testing:Developer] Update example submissions to Python3 (#36)
1 parent b0e9743 commit 2119b10

11 files changed

+31
-32
lines changed

examples/03_multipart/config/config.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
// Each part will appear as a different submission box.
44
"part_names" : [ "Part 1", "Part 2", "Part 3" ],
55

6-
// Submissions for each part are just placed in the part1, part2, etc.
7-
// directories. From there, they can be graded in the same manner as any
6+
// Submissions for each part are just placed in the part1, part2, etc.
7+
// directories. From there, they can be graded in the same manner as any
88
// other submission.
99
"testcases" : [
1010
{
1111
"title" : "Part 1 Compute square root",
12-
"command" : "python part1/*.py",
12+
"command" : "python3 part1/*.py",
1313
"points" : 3,
1414
"validation" : [
15-
{
15+
{
1616
"method" : "diff",
1717
"actual_file" : "STDOUT.txt",
1818
"description" : "Program Output",
@@ -21,11 +21,11 @@
2121
]
2222
},
2323
{
24-
"title" : "Part 2 Solve for x^2 + 5x + 6 = 0",
25-
"command" : "python part2/*.py",
24+
"title" : "Part 2 Solve for x^2 + 5x + 6 = 0",
25+
"command" : "python3 part2/*.py",
2626
"points" : 4,
2727
"validation" : [
28-
{
28+
{
2929
"method" : "diff",
3030
"actual_file" : "STDOUT.txt",
3131
"description" : "Program Output",
@@ -35,10 +35,10 @@
3535
},
3636
{
3737
"title" : "Part 3 Count from 1 to 10",
38-
"command" : "python part3/*.py",
38+
"command" : "python3 part3/*.py",
3939
"points" : 3,
4040
"validation" : [
41-
{
41+
{
4242
"method" : "diff",
4343
"actual_file" : "STDOUT.txt",
4444
"description" : "Program Output",
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import math
2-
print "The square root of 16:", math.sqrt(16)
3-
print "The square root of 9:", math.sqrt(9)
2+
print("The square root of 16:", math.sqrt(16))
3+
print("The square root of 9:", math.sqrt(9))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
print "The square root of 16:", math.sqrt(16)
2-
print "The square root of 9:", math.sqrt(9)
1+
print("The square root of 16:", math.sqrt(16))
2+
print("The square root of 9:", math.sqrt(9))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
print "The square root of 16:", 16^(0.5)
2-
print "The square root of 9:", 9^(0.5)
1+
print("The square root of 16:", 16^(0.5))
2+
print("The square root of 9:", 9^(0.5))
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import math
2-
print "The square root of 16:"
3-
print math.sqrt(16)
4-
print "The square root of 9:"
5-
print math.sqrt(9)
2+
print("The square root of 16:")
3+
print(math.sqrt(16))
4+
print("The square root of 9:")
5+
print(math.sqrt(9))

examples/03_multipart/submissions/part2.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
x1 = ((-1)*b + math.sqrt(b*b - 4*a*c))/(2*a)
77
x2 = ((-1)*b - math.sqrt(b*b - 4*a*c))/(2*a)
88

9-
print "Solution to equation x^2 + 5x + 6 = 0:"
10-
print "x1 =", x1
11-
print "x2 =", x2
9+
print("Solution to equation x^2 + 5x + 6 = 0:")
10+
print("x1 =", x1)
11+
print("x2 =", x2)

examples/03_multipart/submissions/part2_syntax_error1.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
x1 = ((-1)*b + math.sqrt(b*b - 4*a*c))/(2*a)
77
x2 = ((-1)*b - math.sqrt(b*b - 4*a*c))/(2*a)
88

9-
print "Solution to equation x^2 + 5x + 6 = 0:"
10-
print "x1 =" + x1
11-
print "x2 =" + x2
9+
print("Solution to equation x^2 + 5x + 6 = 0:")
10+
print("x1 =" + x1)
11+
print("x2 =" + x2)

examples/03_multipart/submissions/part2_wrong_output.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
x1 = ((-1)*b + math.sqrt(b*b - 4*a*c))/(2*a)
77
x2 = ((-1)*b - math.sqrt(b*b - 4*a*c))/(2*a)
88

9-
print "Solution to equation x^2 + 5x + 6 = 0:"
10-
print "x1 = ", x1
11-
print "x2 = ", x2
9+
print("Solution to equation x^2 + 5x + 6 = 0:")
10+
print("x1 = ", x1)
11+
print("x2 = ", x2)
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
for i in range(1,11):
2-
print i,
1+
print(" ".join([str(x) for x in range(1, 11)]))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
for (i in range(1,11)):
2-
print i,
2+
print(i,)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
for i in range(1,10):
2-
print i,
2+
print(i,)

0 commit comments

Comments
 (0)