106
106
one worksheet, Worksheet Basics. Clicking this takes you to the worksheet,
107
107
where students are challenged by Python questions.
109
After reading the worksheet, attempt the simple programming question, which is
110
to write a factorial program.
112
A sample solution follows::
109
After reading the worksheet, attempt the first simple programming question,
110
which is to write the Hello world program.
112
First, click Submit without writing any code, and note that the system
113
automatically runs a test case, which fails. Now change the code to be "almost
114
right" (for example, write "Hello world" instead of "Hello, world!"), and
115
press Submit again. It will tell you that you almost got it right. In this
116
way, the IVLE test framework can show users that they're on the right track.
117
If you get it exactly right and click Submit a third time, you will pass the
120
Note that you can also click "Run", and it will execute your solution in the
121
Python console. This doesn't cost you an "attempt", nor does it run the test
122
cases. It just lets you test it out for yourself before making an official
125
Back on the subject page, you will notice that the exercise appears complete,
126
and you have been awarded a mark.
128
A sample solution to the second exercise follows::
121
137
f = int(raw_input())
124
First, click Submit, and note that the system automatically runs some test
125
cases, all of which fail. Now paste the solution to :func:`fac` (but not
126
:func:`main`). Clicking Submit again shows some test cases pass, but not all.
127
Finally, paste the solution to :func:`main`, and click Submit again. This
128
time, you will pass the test.
130
Note that you can also click "Run", and it will execute your solution in the
131
Python console. This doesn't cost you an "attempt", nor does it run the test
132
cases. It just lets you test it out for yourself before making an official
135
Back on the subject page, you will notice that the exercise appears complete,
136
and you have been awarded some marks.
138
140
A lecturer's view
139
141
=================