This is what you see when you add the autograder. It’s prefilled with examples of how to write tests.
student_code
: String, the text of the student’s programsolution_code
: String, the text of the solution programstudent_commands
: list of lists, contains all Turtle commands called from student’s code
solution_commands
: same format as student_commands
; contains Turtle commands called from solution codeThis applies to both student_commands
and solution_commands
. It is important to note that these are lists of all Turtle functions called -- calls to user-defined functions or regular Python functions will not show up.
The elements of student_commands
**and solution_commands
are all Turtle functions that were called. There are three forms each element of the commands lists can take, explained below.
begin_fill
and end_fill
functions below.color(“purple”)
** will be listed as [‘color’, ‘purple’]
forward(100)
will be listed as [‘forward’, 100]
[‘fnName’, [‘list’, ‘of’, ‘parameters’]]
. The parameters that were given arguments in the code will be filled with the arguments’ values; parameters that were omitted will have a value of ‘None’.
circle(60)
would be listed as ['circle', [60, 'None','None']]
circle(60, 100)
would be listed as ['circle', [60, 100,'None']]
circle(60, 10, 3)
would be listed as ['circle', [60, 10, 3]]
circle
only takes up to three parameters, which is why each of the results above have an argument list of length three.If user-defined functions are called and contain Turtle functions, those Turtle functions will appear in the list in the order they were called
If the student’s code is the program below:
then student_commands
will be