From 5a1b4202dfa99bb88fab6b1f23594bd2def811c6 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 6 Oct 2015 17:58:54 +0200 Subject: Changes some text descriptions and added a final hint to Fahrenheit. --- python/problems/introduction/ballistics/common.py | 4 ++-- python/problems/introduction/fahrenheit_to_celsius/common.py | 3 +++ python/problems/introduction/fahrenheit_to_celsius/sl.py | 10 ++++++++-- python/problems/introduction/pythagorean_theorem/en.py | 2 -- 4 files changed, 13 insertions(+), 6 deletions(-) (limited to 'python/problems/introduction') diff --git a/python/problems/introduction/ballistics/common.py b/python/problems/introduction/ballistics/common.py index eaf230d..8773dab 100644 --- a/python/problems/introduction/ballistics/common.py +++ b/python/problems/introduction/ballistics/common.py @@ -66,7 +66,7 @@ def test(python, code): '10.05', '3.49', '3.49', - '13.94', + '13.96', '0' ] @@ -78,7 +78,7 @@ def test(python, code): tin = None for i, (output, correct) in enumerate(zip(outputs, test_out)): print (output, float(correct)) - 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].replace('\n', ' ') diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py index df426d3..6549c32 100644 --- a/python/problems/introduction/fahrenheit_to_celsius/common.py +++ b/python/problems/introduction/fahrenheit_to_celsius/common.py @@ -22,6 +22,7 @@ hint_type = { 'name_error': Hint('name_error'), 'unsupported_operand': Hint('unsupported_operand'), 'not_callable': Hint('not_callable'), + 'final_hint': Hint('final_hint'), } def test(python, code): @@ -58,6 +59,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/fahrenheit_to_celsius/sl.py b/python/problems/introduction/fahrenheit_to_celsius/sl.py index f8ca977..b61c436 100644 --- a/python/problems/introduction/fahrenheit_to_celsius/sl.py +++ b/python/problems/introduction/fahrenheit_to_celsius/sl.py @@ -57,8 +57,8 @@ plan = ['''\
  • Izpis temperature v Celzijih (izpiši C).
  • ''', no_input_call, - - + expressions_python, + printing ] hint = { @@ -121,4 +121,10 @@ C = 5/9 * (F – 32).

    Python ne zna izpuščati znaka za množenje, kot to delamo pri matematiki.

    ''' ], + + 'final_hint' : [ + '''\ +

    Odlično, program deluje!
    +Pri tej nalogi si se naučil a) uporabljati funkcijo input, +b) kako spremeniti niz v število, c) računanja v Pythonu in d) izpisati rezultat!

    '''] } diff --git a/python/problems/introduction/pythagorean_theorem/en.py b/python/problems/introduction/pythagorean_theorem/en.py index 72e83aa..b3c6117 100644 --- a/python/problems/introduction/pythagorean_theorem/en.py +++ b/python/problems/introduction/pythagorean_theorem/en.py @@ -8,8 +8,6 @@ description = '''\

    (translation missing)''' hint = { - 'plan': '''\ -

    (translation missing)

    ''', 'no_input_call': '''\

    (translation missing)

    ''', -- cgit v1.2.1