Skip to content

Commit 1120a44

Browse files
committed
Add some examples for variable_content and console_output
1 parent c56f499 commit 1120a44

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

docs/console_output.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,28 @@ an attempt will be made to convert to a float and apply a tolerance. This avoids
1414
e.g. `0`, `0.0` and `0.00000005` should all be considered the same.
1515

1616
This function is implemented in `checks/output_check.py`.
17+
18+
## Examples
19+
20+
<table>
21+
<tr>
22+
<th>Response</th>
23+
<th>Answer</th>
24+
<th>Correct?</th>
25+
</tr>
26+
<tr>
27+
<td><code>print("Hello, World")</code></td>
28+
<td><code>print("Hello, World!")</code></td>
29+
<td>No</td>
30+
</tr>
31+
<tr>
32+
<td><code>print(0)</code></td>
33+
<td><code>print(0.0)</code></td>
34+
<td>Yes (if <code>output_inexact</code> is true)</td>
35+
</tr>
36+
<tr>
37+
<td><pre>print(1)<br>print(2)<br>print(3)<br></pre></td>
38+
<td><pre>for i in range(1, 4):<br> print(i)</pre></td>
39+
<td>Yes</td>
40+
</tr>
41+
</table>

docs/parameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Parameters are communicated from the web application to the evaluation function
44
which are passed to `evaluation_function()` as a dictionary.
55

66
This dictionary has several fields:
7+
78
- `global_variables_check_list`: This is either a list of strings, or a comma-delimited string
89
containing a list of variable names to check. If this list is present, a
910
[global variable check](variable_content.md) is performed, and the given variables are compared

docs/variable_content.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,27 @@ can detect this, and still return a correct result. This facility is experimenta
2020
that any future developers consider improving this feature, and possibly gate it behind a parameter.
2121

2222
This checking function is implemented in `checks/global_variable_check.py`.
23+
24+
## Example
25+
26+
The response in this case will be marked correct.
27+
28+
Response:
29+
```python
30+
test1 = []
31+
for i in range(10)
32+
test1.append(i)
33+
34+
test2 = 10 + 32
35+
```
36+
Answer:
37+
```python
38+
test1 = [i for i in range(10)]
39+
test2 = 42
40+
```
41+
Params:
42+
```json
43+
{
44+
"global_variables_check_list": ["test1", "test2"]
45+
}
46+
```

0 commit comments

Comments
 (0)