summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMartin <martin@leo.fri1.uni-lj.si>2015-09-15 14:59:32 +0200
committerMartin <martin@leo.fri1.uni-lj.si>2015-09-15 14:59:32 +0200
commit7234dbb956f61a3592e029d463cd130ae6461c23 (patch)
tree3fed6326273a70ef8df0815a55d3d59a009270ca /python
parent816ffe9a13c4aa7e1d0d4ec95355e1dcd6e24faa (diff)
Changes to text in Fahrneheit exercise.
Diffstat (limited to 'python')
-rw-r--r--python/problems/introduction/fahrenheit_to_celsius/common.py13
-rw-r--r--python/problems/introduction/fahrenheit_to_celsius/sl.py15
2 files changed, 11 insertions, 17 deletions
diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py
index 8362260..79cdff3 100644
--- a/python/problems/introduction/fahrenheit_to_celsius/common.py
+++ b/python/problems/introduction/fahrenheit_to_celsius/common.py
@@ -22,7 +22,6 @@ hint_type = {
'name_error': HintSequence('name_error', 4),
'unsupported_operand': HintSequence('unsupported_operand', 4),
'not_callable': HintSequence('not_callable', 4),
- 'syntax_error': HintSequence('syntax_error', 4),
'indentation_error': HintSequence('indentation_error', 3),
}
@@ -47,8 +46,6 @@ def test(python, code):
answers = python(code=code, inputs=test_in, timeout=1.0)
outputs = [ans[1] for ans in answers]
- print (answers)
-
n_correct = 0
for output, correct in zip(outputs, test_out):
if correct in output:
@@ -63,13 +60,13 @@ def hint(python, code):
if exc:
if 'NameError' in exc:
return [{'id':'name_error', 'args': {'message': exc}}]
- if 'not callable' in exc:
+ elif 'not callable' in exc:
return [{'id':'not_callable', 'args': {'message': exc}}]
- if 'unsupported operand' in exc:
+ elif 'unsupported operand' in exc:
+ return [{'id':'unsupported_operand', 'args': {'message': exc}}]
+ elif 'TypeError' in exc:
return [{'id':'unsupported_operand', 'args': {'message': exc}}]
- if 'SyntaxError' in exc:
- return [{'id':'syntax_error', 'args': {'message': exc}}]
- if 'IndentationError' in exc:
+ elif 'IndentationError' in exc:
return [{'id':'indentation_error', 'args': {'message': exc}}]
diff --git a/python/problems/introduction/fahrenheit_to_celsius/sl.py b/python/problems/introduction/fahrenheit_to_celsius/sl.py
index 350cd62..41aab7a 100644
--- a/python/problems/introduction/fahrenheit_to_celsius/sl.py
+++ b/python/problems/introduction/fahrenheit_to_celsius/sl.py
@@ -18,8 +18,8 @@ general_exception = {
''',
'general': '''
- <p>Pri razumevanju napake sta pomembni dve vrstici. V drugi vrstici je specificirana lokacija
- napake (line XY), v zadnji vrstici pa izvemo za kakšno napako gre.</p>
+ <p>Pri razumevanju napake sta pomembni dve vrstici. V predzadnji vrstici je napisana lokacija
+ napake (line ...), v zadnji vrstici pa izvemo za kakšno napako gre.</p>
''',
'name_error' : '''
@@ -35,15 +35,12 @@ general_exception = {
''',
'type_error': '''
- <p>TypeError napaka pomeni, da želite izvesti operacijo na nedovoljenih tipih. Npr., če želite sešteti niz in
-število ali klicati funkcijo, čeprav tisto ni funkcija, itd. .</p>
+ <p>TypeError napaka pomeni, da želite izvesti operacijo na nedovoljenih tipih.
+ Npr., če želite sešteti niz in število ali klicati funkcijo, čeprav tisto ni funkcija, itd. .</p>
''',
- 'syntax_error': '''
- <p>Napaka v sintaksi programa. Napisali ste nekaj, kar Python ne zna prebrati.</p> ''',
-
'indentation_error': '''
- <p>Pomeni, da imate napačno število presledkov na začetku vrstice. Poskrbite, da so vse vrstice pravilno
+ <p> Pomeni, da imate napačno število presledkov na začetku vrstice. Poskrbite, da so vse vrstice pravilno
poravnane. </p>'''
}
@@ -84,7 +81,7 @@ c = 2 * a * (3 + b)
<p>Kot vidite, izraz lahko uporablja tudi spremenljivke. </p>''',
'printing': '''
-<p> V Pythonu izpisujemo s funkcijo <code>print. Če želimo izpisati več elementov,
+<p> V Pythonu izpisujemo s funkcijo <code>print</code>. Če želimo izpisati več elementov,
jih ločimo z vejico. Recimo, da imamo spremenljivko <code>ime</code>,
ki vsebuje naše ime, potem lahko napišemo:
<pre>