Skip to content

Commit

Permalink
[Testing:Developer] Update example submissions to Python3 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjallen authored Jun 10, 2022
1 parent b0e9743 commit 2119b10
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 32 deletions.
18 changes: 9 additions & 9 deletions examples/03_multipart/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
// Each part will appear as a different submission box.
"part_names" : [ "Part 1", "Part 2", "Part 3" ],

// Submissions for each part are just placed in the part1, part2, etc.
// directories. From there, they can be graded in the same manner as any
// Submissions for each part are just placed in the part1, part2, etc.
// directories. From there, they can be graded in the same manner as any
// other submission.
"testcases" : [
{
"title" : "Part 1 Compute square root",
"command" : "python part1/*.py",
"command" : "python3 part1/*.py",
"points" : 3,
"validation" : [
{
{
"method" : "diff",
"actual_file" : "STDOUT.txt",
"description" : "Program Output",
Expand All @@ -21,11 +21,11 @@
]
},
{
"title" : "Part 2 Solve for x^2 + 5x + 6 = 0",
"command" : "python part2/*.py",
"title" : "Part 2 Solve for x^2 + 5x + 6 = 0",
"command" : "python3 part2/*.py",
"points" : 4,
"validation" : [
{
{
"method" : "diff",
"actual_file" : "STDOUT.txt",
"description" : "Program Output",
Expand All @@ -35,10 +35,10 @@
},
{
"title" : "Part 3 Count from 1 to 10",
"command" : "python part3/*.py",
"command" : "python3 part3/*.py",
"points" : 3,
"validation" : [
{
{
"method" : "diff",
"actual_file" : "STDOUT.txt",
"description" : "Program Output",
Expand Down
4 changes: 2 additions & 2 deletions examples/03_multipart/submissions/part1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import math
print "The square root of 16:", math.sqrt(16)
print "The square root of 9:", math.sqrt(9)
print("The square root of 16:", math.sqrt(16))
print("The square root of 9:", math.sqrt(9))
4 changes: 2 additions & 2 deletions examples/03_multipart/submissions/part1_syntax_error1.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
print "The square root of 16:", math.sqrt(16)
print "The square root of 9:", math.sqrt(9)
print("The square root of 16:", math.sqrt(16))
print("The square root of 9:", math.sqrt(9))
4 changes: 2 additions & 2 deletions examples/03_multipart/submissions/part1_syntax_error2.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
print "The square root of 16:", 16^(0.5)
print "The square root of 9:", 9^(0.5)
print("The square root of 16:", 16^(0.5))
print("The square root of 9:", 9^(0.5))
8 changes: 4 additions & 4 deletions examples/03_multipart/submissions/part1_wrong_output.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
print "The square root of 16:"
print math.sqrt(16)
print "The square root of 9:"
print math.sqrt(9)
print("The square root of 16:")
print(math.sqrt(16))
print("The square root of 9:")
print(math.sqrt(9))
6 changes: 3 additions & 3 deletions examples/03_multipart/submissions/part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
x1 = ((-1)*b + math.sqrt(b*b - 4*a*c))/(2*a)
x2 = ((-1)*b - math.sqrt(b*b - 4*a*c))/(2*a)

print "Solution to equation x^2 + 5x + 6 = 0:"
print "x1 =", x1
print "x2 =", x2
print("Solution to equation x^2 + 5x + 6 = 0:")
print("x1 =", x1)
print("x2 =", x2)
6 changes: 3 additions & 3 deletions examples/03_multipart/submissions/part2_syntax_error1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
x1 = ((-1)*b + math.sqrt(b*b - 4*a*c))/(2*a)
x2 = ((-1)*b - math.sqrt(b*b - 4*a*c))/(2*a)

print "Solution to equation x^2 + 5x + 6 = 0:"
print "x1 =" + x1
print "x2 =" + x2
print("Solution to equation x^2 + 5x + 6 = 0:")
print("x1 =" + x1)
print("x2 =" + x2)
6 changes: 3 additions & 3 deletions examples/03_multipart/submissions/part2_wrong_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
x1 = ((-1)*b + math.sqrt(b*b - 4*a*c))/(2*a)
x2 = ((-1)*b - math.sqrt(b*b - 4*a*c))/(2*a)

print "Solution to equation x^2 + 5x + 6 = 0:"
print "x1 = ", x1
print "x2 = ", x2
print("Solution to equation x^2 + 5x + 6 = 0:")
print("x1 = ", x1)
print("x2 = ", x2)
3 changes: 1 addition & 2 deletions examples/03_multipart/submissions/part3.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
for i in range(1,11):
print i,
print(" ".join([str(x) for x in range(1, 11)]))
2 changes: 1 addition & 1 deletion examples/03_multipart/submissions/part3_syntax_error1.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
for (i in range(1,11)):
print i,
print(i,)
2 changes: 1 addition & 1 deletion examples/03_multipart/submissions/part3_wrong_output.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
for i in range(1,10):
print i,
print(i,)

0 comments on commit 2119b10

Please sign in to comment.