summaryrefslogtreecommitdiff
path: root/python/problems
diff options
context:
space:
mode:
Diffstat (limited to 'python/problems')
-rw-r--r--python/problems/introduction/ballistics/common.py3
-rw-r--r--python/problems/introduction/ballistics/sl.py8
-rw-r--r--python/problems/introduction/pythagorean_theorem/common.py9
-rw-r--r--python/problems/introduction/pythagorean_theorem/sl.py9
4 files changed, 24 insertions, 5 deletions
diff --git a/python/problems/introduction/ballistics/common.py b/python/problems/introduction/ballistics/common.py
index 8773dab..afb84b6 100644
--- a/python/problems/introduction/ballistics/common.py
+++ b/python/problems/introduction/ballistics/common.py
@@ -29,6 +29,7 @@ hint_type = {
'radians': Hint('radians'),
'printing': Hint('printing'),
'betterg': Hint('betterg'),
+ 'final_hint': Hint('final_hint')
}
def contains_negative(s):
@@ -88,6 +89,8 @@ def test(python, code):
hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_in)}}]
if tin:
hints.append({'id': 'problematic_test_case', 'args': {'testin': str(tin), 'testout': str(tout)}})
+ if passed:
+ hints.append({'id': 'final_hint'})
return passed, hints
def hint(python, code):
diff --git a/python/problems/introduction/ballistics/sl.py b/python/problems/introduction/ballistics/sl.py
index 9c0cb36..fa0fe5d 100644
--- a/python/problems/introduction/ballistics/sl.py
+++ b/python/problems/introduction/ballistics/sl.py
@@ -92,5 +92,11 @@ ki jo moramo najprej pretvoriti v tip <code>float</code>:</p>
<pre>
v = float(input(" ...
</pre>
-''']
+'''],
+ 'final_hint' : [
+ '''\
+<p>Odlično, program deluje pravilno! <br>
+Če želiš še kaj več izvedeti o <a href="https://en.wikipedia.org/wiki/Topology
+">topologiji</a> ... </p>''']
+
}
diff --git a/python/problems/introduction/pythagorean_theorem/common.py b/python/problems/introduction/pythagorean_theorem/common.py
index d11dae0..ed49b1a 100644
--- a/python/problems/introduction/pythagorean_theorem/common.py
+++ b/python/problems/introduction/pythagorean_theorem/common.py
@@ -23,7 +23,8 @@ hint_type = {
'unsupported_operand': Hint('unsupported_operand'),
'no_input_call' : Hint('no_input_call'),
'printing': Hint('printing'),
- 'math_functions': Hint('math_functions')
+ 'math_functions': Hint('math_functions'),
+ 'final_hint': Hint('final_hint')
}
def test(python, code):
@@ -55,7 +56,7 @@ def test(python, code):
n_correct = 0
tin = None
for i, (output, correct) in enumerate(zip(outputs, test_out)):
- if string_almost_equal(output, float(correct)):
+ if string_almost_equal(output, float(correct), prec=2):
n_correct += 1
else:
tin = test_in[i][1]
@@ -65,6 +66,8 @@ def test(python, code):
hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_in)}}]
if tin:
hints.append({'id': 'problematic_test_case', 'args': {'testin': str(tin), 'testout': str(tout)}})
+ if passed:
+ hints.append({'id': 'final_hint'})
return passed, hints
def hint(python, code):
@@ -85,7 +88,7 @@ def hint(python, code):
# if input is not present in code, student needs to learn about input
if not has_token_sequence(tokens, ['input']) or \
- not has_token_sequence(tokens, ['float']) or \
+ (not has_token_sequence(tokens, ['float']) and not has_token_sequence(tokens, ['int'])) or \
not has_token_sequence(tokens, ['=']):
return [{'id': 'no_input_call'}]
diff --git a/python/problems/introduction/pythagorean_theorem/sl.py b/python/problems/introduction/pythagorean_theorem/sl.py
index b3424cb..21aec9a 100644
--- a/python/problems/introduction/pythagorean_theorem/sl.py
+++ b/python/problems/introduction/pythagorean_theorem/sl.py
@@ -89,6 +89,13 @@ ki jo moramo najprej pretvoriti v tip <code>float</code>, če želimo z njo rač
<pre>
v = float(input(" ...
</pre>
-''']
+'''],
+
+ 'final_hint' : [
+ '''\
+<p>Program deluje pravilno! <br>
+To pomeni, da znaš uporabljati matematične funkcije, ki so v modulu
+<a href="https://docs.python.org/3.5/library/math.html"><code>math</code></a>.
+Tekom tega sklopa si bomo pogledali še modula za delo z nakjučnimi števili in za delo s časom. </p>''']
}