summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMartin <martin@leo.fri1.uni-lj.si>2015-10-02 16:14:24 +0200
committerMartin <martin@leo.fri1.uni-lj.si>2015-10-02 16:14:24 +0200
commit4e7b80974d7433f96fa1908293e5faee9d8de519 (patch)
tree9137c6a2fb801a7f0527530f0909976e39728ef6 /python
parentdf229fbab5f8cf2b310bc44e1501f03149fceb65 (diff)
Removed unnecessary HintSequences.
Diffstat (limited to 'python')
-rw-r--r--python/common.py2
-rw-r--r--python/en.py46
-rw-r--r--python/problems/functions/greatest/common.py2
-rw-r--r--python/problems/functions/greatest_absolutist/common.py2
-rw-r--r--python/problems/functions/greatest_negative/common.py2
-rw-r--r--python/problems/introduction/average/common.py2
-rw-r--r--python/problems/introduction/ballistics/common.py2
-rw-r--r--python/problems/introduction/fahrenheit_to_celsius/common.py2
-rw-r--r--python/problems/introduction/fast_fingers/common.py2
-rw-r--r--python/problems/introduction/fast_fingers_2/common.py2
-rw-r--r--python/problems/introduction/pythagorean_theorem/common.py6
-rw-r--r--python/problems/lists_and_for/contains_42/common.py3
-rw-r--r--python/problems/lists_and_for/contains_string/common.py3
-rw-r--r--python/problems/while_and_if/buy_five/common.py2
-rw-r--r--python/problems/while_and_if/checking_account/common.py2
-rw-r--r--python/problems/while_and_if/competition/common.py9
-rw-r--r--python/problems/while_and_if/consumers_anonymous/common.py9
-rw-r--r--python/problems/while_and_if/consumers_anonymous/en.py48
-rw-r--r--python/problems/while_and_if/consumers_anonymous/sl.py1
-rw-r--r--python/problems/while_and_if/minimax/common.py2
-rw-r--r--python/problems/while_and_if/top_shop/common.py2
21 files changed, 119 insertions, 32 deletions
diff --git a/python/common.py b/python/common.py
index e4de997..26f3881 100644
--- a/python/common.py
+++ b/python/common.py
@@ -1,7 +1,7 @@
# coding=utf-8
import ast
-from server.hints import Hint, HintSequence
+from server.hints import Hint
hint_type = {
'no_hint': Hint('no_hint'),
diff --git a/python/en.py b/python/en.py
index 77157f1..33453a9 100644
--- a/python/en.py
+++ b/python/en.py
@@ -3,6 +3,27 @@
name = 'Python'
description = 'Introductory Python course.'
+
+general_msg = {
+ 'error_head' : '''\
+''',
+
+ 'general_exception': '''\
+''',
+
+ 'name_error' : '''\
+''',
+
+ 'type_error': '''\
+''',
+
+ 'eof_error':'''\
+''',
+
+ 'timed_out':'''\
+'''
+}
+
hint = {
'no_hint': '''\
<p>No hint available, sorry!</p>
@@ -18,4 +39,27 @@ hint = {
[%=message%]
</pre>
''',
-}
+
+ 'system_error': ['''\
+'''],
+
+ 'problematic_test_case': ['''\
+'''],
+
+ 'no_func_name': ['''\
+'''],
+
+ 'name_error' : [general_msg['error_head'],
+ general_msg['general_exception'],
+ general_msg['name_error']],
+
+ 'type_error' : [general_msg['error_head'],
+ general_msg['general_exception'],
+ general_msg['type_error']],
+
+ 'error' : [general_msg['error_head'], general_msg['general_exception']],
+
+ 'eof_error' : [general_msg['eof_error']],
+
+ 'timed_out' : [general_msg['timed_out']]
+} \ No newline at end of file
diff --git a/python/problems/functions/greatest/common.py b/python/problems/functions/greatest/common.py
index 74fb15e..6857603 100644
--- a/python/problems/functions/greatest/common.py
+++ b/python/problems/functions/greatest/common.py
@@ -3,7 +3,7 @@
import re
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 195
group = 'functions'
diff --git a/python/problems/functions/greatest_absolutist/common.py b/python/problems/functions/greatest_absolutist/common.py
index 8174a63..2d80097 100644
--- a/python/problems/functions/greatest_absolutist/common.py
+++ b/python/problems/functions/greatest_absolutist/common.py
@@ -3,7 +3,7 @@
import re
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 196
group = 'functions'
diff --git a/python/problems/functions/greatest_negative/common.py b/python/problems/functions/greatest_negative/common.py
index 2425bbc..5d65438 100644
--- a/python/problems/functions/greatest_negative/common.py
+++ b/python/problems/functions/greatest_negative/common.py
@@ -3,7 +3,7 @@
import re
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 197
group = 'functions'
diff --git a/python/problems/introduction/average/common.py b/python/problems/introduction/average/common.py
index c84ef72..1609a6f 100644
--- a/python/problems/introduction/average/common.py
+++ b/python/problems/introduction/average/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 189
diff --git a/python/problems/introduction/ballistics/common.py b/python/problems/introduction/ballistics/common.py
index 10ef692..eaf230d 100644
--- a/python/problems/introduction/ballistics/common.py
+++ b/python/problems/introduction/ballistics/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 187
group = 'introduction'
diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py
index 485d59d..df426d3 100644
--- a/python/problems/introduction/fahrenheit_to_celsius/common.py
+++ b/python/problems/introduction/fahrenheit_to_celsius/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 180
group = 'introduction'
diff --git a/python/problems/introduction/fast_fingers/common.py b/python/problems/introduction/fast_fingers/common.py
index cda6486..dc04dcf 100644
--- a/python/problems/introduction/fast_fingers/common.py
+++ b/python/problems/introduction/fast_fingers/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 190
group = 'introduction'
diff --git a/python/problems/introduction/fast_fingers_2/common.py b/python/problems/introduction/fast_fingers_2/common.py
index 386e251..6261d92 100644
--- a/python/problems/introduction/fast_fingers_2/common.py
+++ b/python/problems/introduction/fast_fingers_2/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 191
group = 'introduction'
diff --git a/python/problems/introduction/pythagorean_theorem/common.py b/python/problems/introduction/pythagorean_theorem/common.py
index 193527e..d11dae0 100644
--- a/python/problems/introduction/pythagorean_theorem/common.py
+++ b/python/problems/introduction/pythagorean_theorem/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 188
group = 'introduction'
@@ -19,8 +19,8 @@ print("Hipotenuza trikotnika s stranicama", a, "in", b, "je", c)
hint_type = {
'plan': Hint('plan'),
- 'name_error': HintSequence('name_error', 4),
- 'unsupported_operand': HintSequence('unsupported_operand', 4),
+ 'name_error': Hint('name_error'),
+ 'unsupported_operand': Hint('unsupported_operand'),
'no_input_call' : Hint('no_input_call'),
'printing': Hint('printing'),
'math_functions': Hint('math_functions')
diff --git a/python/problems/lists_and_for/contains_42/common.py b/python/problems/lists_and_for/contains_42/common.py
index 915938e..f91465f 100644
--- a/python/problems/lists_and_for/contains_42/common.py
+++ b/python/problems/lists_and_for/contains_42/common.py
@@ -3,7 +3,7 @@
import re
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 193
group = 'lists_and_for'
@@ -21,7 +21,6 @@ print(vsebuje)
'''
hint_type = {
- 'plan': HintSequence('plan', 1),
'no_xs': Hint('no_xs'),
'for_loop': Hint('for_loop'),
'if_clause': Hint('if_clause'),
diff --git a/python/problems/lists_and_for/contains_string/common.py b/python/problems/lists_and_for/contains_string/common.py
index 0fe7c00..29bc9f2 100644
--- a/python/problems/lists_and_for/contains_string/common.py
+++ b/python/problems/lists_and_for/contains_string/common.py
@@ -3,7 +3,7 @@
import re
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 194
group = 'lists_and_for'
@@ -21,7 +21,6 @@ print(vsebuje)
'''
hint_type = {
- 'plan': HintSequence('plan', 1),
'no_xs': Hint('no_xs'),
'for_loop': Hint('for_loop'),
'if_clause': Hint('if_clause'),
diff --git a/python/problems/while_and_if/buy_five/common.py b/python/problems/while_and_if/buy_five/common.py
index 9f335af..ba44f5b 100644
--- a/python/problems/while_and_if/buy_five/common.py
+++ b/python/problems/while_and_if/buy_five/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 185
group = 'while_and_if'
diff --git a/python/problems/while_and_if/checking_account/common.py b/python/problems/while_and_if/checking_account/common.py
index 610bbfc..ee1e3ee 100644
--- a/python/problems/while_and_if/checking_account/common.py
+++ b/python/problems/while_and_if/checking_account/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 200
group = 'while_and_if'
diff --git a/python/problems/while_and_if/competition/common.py b/python/problems/while_and_if/competition/common.py
index a7471df..fff96ed 100644
--- a/python/problems/while_and_if/competition/common.py
+++ b/python/problems/while_and_if/competition/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 192
group = 'while_and_if'
@@ -19,9 +19,14 @@ print('Vsota:', vsota)
'''
hint_type = {
- 'plan': HintSequence('plan', 1),
+ 'read_before_while': Hint('read_before_while'),
+ 'while_clause': Hint('while_clause'),
+ 'printing': Hint('printing'),
+ 'summation': Hint('summation'),
+ 'nonumber': Hint('nonumber'),
}
+
def test(python, code):
# List of inputs: (expression to eval, stdin).
test_in = [
diff --git a/python/problems/while_and_if/consumers_anonymous/common.py b/python/problems/while_and_if/consumers_anonymous/common.py
index d1428d8..ff3f928 100644
--- a/python/problems/while_and_if/consumers_anonymous/common.py
+++ b/python/problems/while_and_if/consumers_anonymous/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 201
group = 'while_and_if'
@@ -30,8 +30,9 @@ hint_type = {
'nonumber': Hint('nonumber'),
'while_condition': Hint('while_condition'),
'final_hint': Hint('final_hint'),
- 'summation': Hint('final_hint'),
- 'counting': Hint('final_hint'),
+ 'summation': Hint('summation'),
+ 'counting': Hint('counting'),
+ 'problematic_test_case': Hint('problematic_test_case'),
}
def test(python, code):
@@ -69,7 +70,7 @@ def test(python, code):
tout = correct
passed = n_correct == len(test_in)
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_in)}}]
+ hints = [{'id': 'test_results', 'args': {'passed': str(n_correct), 'total': str(len(test_in))}}]
if tin:
hints.append({'id': 'problematic_test_case', 'args': {'testin': str(tin),
'sum': str(tout[0]),
diff --git a/python/problems/while_and_if/consumers_anonymous/en.py b/python/problems/while_and_if/consumers_anonymous/en.py
index 94ea662..6331570 100644
--- a/python/problems/while_and_if/consumers_anonymous/en.py
+++ b/python/problems/while_and_if/consumers_anonymous/en.py
@@ -1,4 +1,6 @@
# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
id = 201
name = 'Consumers Anonymous'
@@ -7,10 +9,48 @@ slug = 'Consumers Anonymous'
description = '''\
<p>(translation missing)</p>'''
+
+main_plan = ['''\
+''']
+
+while_condition = ['''\
+''']
+
+while_clause = ['''\
+'''
+]
+
+plan = [main_plan,
+ while_condition]
+
hint = {
- 'plan': '''\
-<p>(translation missing)</p>''',
+ 'while_clause': while_clause,
+
+ 'while_condition': while_condition,
+
+ 'printing': ['''\
+'''],
- 'no_input_call': '''\
-<p>(translation missing)</p>''',
+ 'nonumber': ['''<p><p>'''],
+
+ 'summation': ['''<p><p>'''],
+
+ 'counting': ['''<p><p>'''],
+
+ 'name_error' : [mod.general_msg['error_head'],
+ mod.general_msg['general_exception'],
+ mod.general_msg['name_error'],
+ '''\
+'''],
+
+ 'problematic_test_case': ['''\
+'''],
+
+ 'final_hint': ['''\
+'''],
+
+ 'eof_error':[mod.general_msg['eof_error'],
+ '''\
+''']
}
+
diff --git a/python/problems/while_and_if/consumers_anonymous/sl.py b/python/problems/while_and_if/consumers_anonymous/sl.py
index 4b1348b..ee2700c 100644
--- a/python/problems/while_and_if/consumers_anonymous/sl.py
+++ b/python/problems/while_and_if/consumers_anonymous/sl.py
@@ -63,7 +63,6 @@ cena != 0 and vsota < 100 and artiklov < 10
</pre>
''']
-
plan = [main_plan,
while_condition]
diff --git a/python/problems/while_and_if/minimax/common.py b/python/problems/while_and_if/minimax/common.py
index 6155024..71632b7 100644
--- a/python/problems/while_and_if/minimax/common.py
+++ b/python/problems/while_and_if/minimax/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 199
group = 'while_and_if'
diff --git a/python/problems/while_and_if/top_shop/common.py b/python/problems/while_and_if/top_shop/common.py
index db98212..115dc9e 100644
--- a/python/problems/while_and_if/top_shop/common.py
+++ b/python/problems/while_and_if/top_shop/common.py
@@ -2,7 +2,7 @@
from python.util import has_token_sequence, string_almost_equal, \
string_contains_number, get_tokens, get_numbers, get_exception_desc
-from server.hints import Hint, HintSequence
+from server.hints import Hint
id = 198
group = 'while_and_if'