summaryrefslogtreecommitdiff
path: root/python/problems/while_and_if
diff options
context:
space:
mode:
authorJure Žabkar <jure.zabkar@fri.uni-lj.si>2015-10-12 14:19:07 +0200
committerJure Žabkar <jure.zabkar@fri.uni-lj.si>2015-10-12 14:19:07 +0200
commit0a88716110994f789f764704a96791fdfb5fa288 (patch)
tree788c16ab578cf76eda358abc1d0587503d413a87 /python/problems/while_and_if
parent1a7678b37a25a76aeaef7ebb225f85406b19f928 (diff)
parent5a01c2bb184152c6ccc3c536e9b857d247bc55ad (diff)
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-problems
Conflicts: robot/problems/introduction/forward/en.py robot/problems/introduction/forward/sl.py
Diffstat (limited to 'python/problems/while_and_if')
-rw-r--r--python/problems/while_and_if/buy_five/common.py1
-rw-r--r--python/problems/while_and_if/buy_five/en.py1
-rw-r--r--python/problems/while_and_if/buy_five/sl.py13
-rw-r--r--python/problems/while_and_if/checking_account/common.py1
-rw-r--r--python/problems/while_and_if/checking_account/en.py4
-rw-r--r--python/problems/while_and_if/checking_account/sl.py5
-rw-r--r--python/problems/while_and_if/common.py2
-rw-r--r--python/problems/while_and_if/competition/common.py1
-rw-r--r--python/problems/while_and_if/competition/en.py1
-rw-r--r--python/problems/while_and_if/competition/sl.py7
-rw-r--r--python/problems/while_and_if/consumers_anonymous/common.py3
-rw-r--r--python/problems/while_and_if/consumers_anonymous/en.py4
-rw-r--r--python/problems/while_and_if/consumers_anonymous/sl.py11
-rw-r--r--python/problems/while_and_if/minimax/common.py3
-rw-r--r--python/problems/while_and_if/minimax/en.py1
-rw-r--r--python/problems/while_and_if/minimax/sl.py3
-rw-r--r--python/problems/while_and_if/top_shop/common.py3
-rw-r--r--python/problems/while_and_if/top_shop/en.py1
-rw-r--r--python/problems/while_and_if/top_shop/sl.py6
19 files changed, 29 insertions, 42 deletions
diff --git a/python/problems/while_and_if/buy_five/common.py b/python/problems/while_and_if/buy_five/common.py
index ba44f5b..a96b2b0 100644
--- a/python/problems/while_and_if/buy_five/common.py
+++ b/python/problems/while_and_if/buy_five/common.py
@@ -5,7 +5,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 185
-group = 'while_and_if'
number = 1
visible = True
diff --git a/python/problems/while_and_if/buy_five/en.py b/python/problems/while_and_if/buy_five/en.py
index 7e522da..9ad1f06 100644
--- a/python/problems/while_and_if/buy_five/en.py
+++ b/python/problems/while_and_if/buy_five/en.py
@@ -1,6 +1,5 @@
# coding=utf-8
-id = 185
name = 'Buy five'
slug = 'Buy five'
diff --git a/python/problems/while_and_if/buy_five/sl.py b/python/problems/while_and_if/buy_five/sl.py
index 22fa7b4..3dbc9d3 100644
--- a/python/problems/while_and_if/buy_five/sl.py
+++ b/python/problems/while_and_if/buy_five/sl.py
@@ -2,7 +2,6 @@
import server
mod = server.problems.load_language('python', 'sl')
-id = 185
name = 'Blagajna "vse po pet"'
slug = 'Blagajna "vse po pet"'
@@ -22,7 +21,7 @@ Vsota: 16
'''
bad_solution = ['''\
-<p><b>Primer, kako NE reševati</b></h3>
+<p>Primer, kako NE reševati</h3>
<pre>
cena1 = float(input('Cena artikla: '))
cena2 = float(input('Cena artikla: '))
@@ -36,7 +35,7 @@ print ("Vsota: " + vsota)
<p>Rešitev je slaba, saj imamo pet enakih vrstic! Uporabite zanko! </p>''']
main_plan = ['''\
-<p><b>Plan:</b></p>
+<p>Plan:</p>
<pre>
1. Ponavljaj 5x:
2. Preberi ceno.
@@ -45,9 +44,9 @@ main_plan = ['''\
</pre>''']
while_clause = ['''\
-<p>Kako bi nekaj <b>5x ponovil</b>?</p>''',
+<p>Uporabi zanko <code>while</code>.</p>''',
'''\
-<p>Zanka while ima naslednjo sintakso:</p>
+<p>Zanka <code>while</code> ima naslednjo sintakso:</p>
<pre>
while Pogoj:
stavek 1
@@ -62,7 +61,7 @@ našem primeru s stavkom n.</p>'''
]
reading_while = ['''\
-<p>Za <b>večkratno branje</b> želimo uporabiti zanko</p>''',
+<p>Za večkratno branje želimo uporabiti zanko</p>''',
'''\
<pre>
@@ -94,7 +93,7 @@ while stevec < 5:
''']
summation = ['''\
-<p><b>Računanje vsote</b> bo najlažje sproti v zanki. <p>''',
+<p>Računaj vsoto sproti v zanki. <p>''',
'''\
<p>Izmisli si spremenljivko, ki bo predstavljala vsoto, jo na
diff --git a/python/problems/while_and_if/checking_account/common.py b/python/problems/while_and_if/checking_account/common.py
index ee1e3ee..002003f 100644
--- a/python/problems/while_and_if/checking_account/common.py
+++ b/python/problems/while_and_if/checking_account/common.py
@@ -5,7 +5,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 200
-group = 'while_and_if'
number = 5
visible = True
diff --git a/python/problems/while_and_if/checking_account/en.py b/python/problems/while_and_if/checking_account/en.py
index 1d36474..47633e8 100644
--- a/python/problems/while_and_if/checking_account/en.py
+++ b/python/problems/while_and_if/checking_account/en.py
@@ -1,8 +1,8 @@
# coding=utf-8
id = 199
-name = 'Checking Account'
-slug = 'Checking Account'
+name = 'Checking account'
+slug = 'Checking account'
description = '''\
<p>(translation missing)</p>'''
diff --git a/python/problems/while_and_if/checking_account/sl.py b/python/problems/while_and_if/checking_account/sl.py
index 2825431..86f973b 100644
--- a/python/problems/while_and_if/checking_account/sl.py
+++ b/python/problems/while_and_if/checking_account/sl.py
@@ -2,7 +2,6 @@
import server
mod = server.problems.load_language('python', 'sl')
-id = 200
name = 'Tekoči račun'
slug = 'Tekoči račun'
@@ -11,7 +10,7 @@ description = '''\
<p>Državna agencija za varstvo potrošnikov je razpisala projekt za izdelavo programa, s katerimi bodo
lahko potrošniki nadzorovali svoje tekoče račune. V program uporabniki vtipkavajo prejemke in
izdatke (kot pozitivne in negativne zneske) na svojem tekočem računu. Program jim sproti izpisuje
-stanje in se ustavi, ko je uporabnik v minusu za 100 evrov ali več.</p>
+stanje in se ustavi, ko je uporabnik v minusu za 100 evrov ali več. Takrat naj program izpiše "Bankrot". </p>
<pre>
Sprememba 23
Stanje 23
@@ -32,7 +31,7 @@ Bankrot
'''
main_plan = ['''\
-<p><b>Plan</b></p> je enak kot pri prejšnjih nalogah, le vsebina je drugačna:
+<p>Plan je enak kot pri prejšnjih nalogah, le vsebina je drugačna:
<pre>
1.Ponavljaj dokler ni bankrot
2.Preberi ceno
diff --git a/python/problems/while_and_if/common.py b/python/problems/while_and_if/common.py
new file mode 100644
index 0000000..c4071df
--- /dev/null
+++ b/python/problems/while_and_if/common.py
@@ -0,0 +1,2 @@
+id = 14
+number = 2 \ No newline at end of file
diff --git a/python/problems/while_and_if/competition/common.py b/python/problems/while_and_if/competition/common.py
index fff96ed..8d2c098 100644
--- a/python/problems/while_and_if/competition/common.py
+++ b/python/problems/while_and_if/competition/common.py
@@ -5,7 +5,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 192
-group = 'while_and_if'
number = 2
visible = True
diff --git a/python/problems/while_and_if/competition/en.py b/python/problems/while_and_if/competition/en.py
index f6399a2..215665c 100644
--- a/python/problems/while_and_if/competition/en.py
+++ b/python/problems/while_and_if/competition/en.py
@@ -1,6 +1,5 @@
# coding=utf-8
-id = 185
name = 'Competition'
slug = 'Competition'
diff --git a/python/problems/while_and_if/competition/sl.py b/python/problems/while_and_if/competition/sl.py
index 8d01ad4..195b51f 100644
--- a/python/problems/while_and_if/competition/sl.py
+++ b/python/problems/while_and_if/competition/sl.py
@@ -3,7 +3,6 @@ import server
mod = server.problems.load_language('python', 'sl')
-id = 192
name = 'Blagajna "konkurenca"'
slug = 'Blagajna "konkurenca"'
@@ -21,7 +20,7 @@ Vsota: 7
</pre>
'''
main_plan = ['''\
-<p><b>Plan</b> bo enak kot pri prejšnji nalogi,
+<p>Plan bo enak kot pri prejšnji nalogi,
le število ponavljanj se spremeni. </p>''',
'''\
<pre>
@@ -35,7 +34,7 @@ plan = [main_plan]
while_clause = ['''\
-<p>Kako bi <b>prebral 5 cen</b> z uporabo zanke while?</p>''',
+<p>Kako bi prebral N cen z uporabo zanke while?</p>''',
'''\
<p>Zanka while ima naslednjo sintakso:</p>
<pre>
@@ -52,7 +51,7 @@ našem primeru s stavkom n.</p>'''
]
summation = ['''\
-<p><b>Računanje vsote</b> bo najlažje sproti v zanki. <p>''',
+<p>Računaj vsoto sproti v zanki. <p>''',
'''\
<p>Izmisli si spremenljivko, ki bo predstavljala vsoto, jo na
diff --git a/python/problems/while_and_if/consumers_anonymous/common.py b/python/problems/while_and_if/consumers_anonymous/common.py
index 07a0ebf..895d985 100644
--- a/python/problems/while_and_if/consumers_anonymous/common.py
+++ b/python/problems/while_and_if/consumers_anonymous/common.py
@@ -5,7 +5,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 201
-group = 'while_and_if'
number = 6
visible = True
@@ -111,7 +110,7 @@ def hint(python, code):
return [{'id' : 'printing'}]
# student does not print any values
- if not get_numbers(answer[0][1]):
+ if len(get_numbers(answer[0][1])) < 2:
return [{'id' : 'nonumber'}]
# student's answer is not correct (three possibilities)
diff --git a/python/problems/while_and_if/consumers_anonymous/en.py b/python/problems/while_and_if/consumers_anonymous/en.py
index 6331570..9691ac2 100644
--- a/python/problems/while_and_if/consumers_anonymous/en.py
+++ b/python/problems/while_and_if/consumers_anonymous/en.py
@@ -3,8 +3,8 @@ import server
mod = server.problems.load_language('python', 'sl')
id = 201
-name = 'Consumers Anonymous'
-slug = 'Consumers Anonymous'
+name = 'Consumers anonymous'
+slug = 'Consumers anonymous'
description = '''\
<p>(translation missing)</p>'''
diff --git a/python/problems/while_and_if/consumers_anonymous/sl.py b/python/problems/while_and_if/consumers_anonymous/sl.py
index 284abbc..131a13b 100644
--- a/python/problems/while_and_if/consumers_anonymous/sl.py
+++ b/python/problems/while_and_if/consumers_anonymous/sl.py
@@ -2,7 +2,6 @@
import server
mod = server.problems.load_language('python', 'sl')
-id = 201
name = 'Klub anonimnih potrošnikov'
slug = 'Klub anonimnih potrošnikov'
@@ -46,17 +45,17 @@ Porabili boste 10 evrov za 10 stvari.
'''
main_plan = ['''\
-<p><b>Plan</b> je enak kot pri prejšnjih nalogah: while zanka + izpis števca in vsote. </p>
+<p>Plan je enak kot pri prejšnjih nalogah: while zanka + izpis števca in vsote. </p>
''']
while_condition = ['''\
-<p><b>Pogoj</b> v zanki while bo sestavljen iz več pogojev.</p>''',
+<p>Pogoj v zanki <code>while</code> bo sestavljen iz več pogojev.</p>''',
'''\
<p>V Pythonu združujemo pogoje z logičnimi operatoriji <code>and</code>,
<code>or</code> in <code>not</code></p>'''
'''\
<p>Zanka se ustavi, če presežemo 100 EUR, če smo vpisali 0 ali kupili 10 stvari.
-Vendar pazite: napisati moramo pogoj, kdaj se zanka <b>nadaljuje</b>!</p>''',
+Vendar pazite: napisati moramo pogoj, kdaj se zanka nadaljuje!</p>''',
'''\
<pre>
cena != 0 and vsota < 100 and artiklov < 10
@@ -110,10 +109,10 @@ hint = {
Pravilna vsota [%=sum%], pravilno število stvari: [%=count%]'''],
'final_hint': ['''\
-<p><b>Odlično!</b> Naloga rešena.</p>
+<p>Odlično! Naloga rešena.<br>
Še zanimivost: v while zanki smo dobili ustavitveni pogoj tako, da smo negirali pogoj iz teksta (ali vnesemo 0 ali je
vnešenih deset števil ali ko vsota cen doseže ali preseže 100 evrov). Pri tem smo ali (or) spremenili v in (and):
-<code>cena > 0 and stevec < 10 and vsota < 100</code>. Temu pravimo De Morganov zakon.
+<code>cena > 0 and stevec < 10 and vsota < 100</code>. Temu pravimo De Morganov zakon.</p>
'''],
'eof_error':[mod.general_msg['eof_error'],
diff --git a/python/problems/while_and_if/minimax/common.py b/python/problems/while_and_if/minimax/common.py
index 71632b7..d853058 100644
--- a/python/problems/while_and_if/minimax/common.py
+++ b/python/problems/while_and_if/minimax/common.py
@@ -5,7 +5,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 199
-group = 'while_and_if'
number = 4
visible = True
@@ -60,7 +59,7 @@ def test(python, code):
n_correct = 0
tin = None
for i, (output, correct) in enumerate(zip(outputs, test_out)):
- if all(string_almost_equal(output, correct[i]) for i in range(4)):
+ if all(string_almost_equal(output, correct[i], prec=2) for i in range(4)):
n_correct += 1
else:
tin = test_in[i][1]
diff --git a/python/problems/while_and_if/minimax/en.py b/python/problems/while_and_if/minimax/en.py
index 10689ec..2aee417 100644
--- a/python/problems/while_and_if/minimax/en.py
+++ b/python/problems/while_and_if/minimax/en.py
@@ -1,6 +1,5 @@
# coding=utf-8
-id = 200
name = 'Minimax'
slug = 'Minimax'
diff --git a/python/problems/while_and_if/minimax/sl.py b/python/problems/while_and_if/minimax/sl.py
index a76bd2e..0d934b8 100644
--- a/python/problems/while_and_if/minimax/sl.py
+++ b/python/problems/while_and_if/minimax/sl.py
@@ -2,7 +2,6 @@
import server
mod = server.problems.load_language('python', 'sl')
-id = 199
name = 'Blagajna "minimax"'
slug = 'Blagajna "minimax"'
@@ -22,7 +21,7 @@ Najvišja cena: 4
'''
main_plan = ['''\
-<p><b>Plan:</b></p>
+<p>Plan:</p>
<pre>
1. Ponavljaj dokler je cena večja od 0:
2. Preberi ceno.
diff --git a/python/problems/while_and_if/top_shop/common.py b/python/problems/while_and_if/top_shop/common.py
index 115dc9e..02855ec 100644
--- a/python/problems/while_and_if/top_shop/common.py
+++ b/python/problems/while_and_if/top_shop/common.py
@@ -5,7 +5,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 198
-group = 'while_and_if'
number = 3
visible = True
@@ -55,7 +54,7 @@ def test(python, code):
n_correct = 0
tin = None
for i, (output, correct) in enumerate(zip(outputs, test_out)):
- if all(string_almost_equal(output, correct[i]) for i in range(2)):
+ if all(string_almost_equal(output, correct[i], prec=2) for i in range(2)):
n_correct += 1
else:
tin = test_in[i][1]
diff --git a/python/problems/while_and_if/top_shop/en.py b/python/problems/while_and_if/top_shop/en.py
index a69ae9a..b8e5119 100644
--- a/python/problems/while_and_if/top_shop/en.py
+++ b/python/problems/while_and_if/top_shop/en.py
@@ -1,6 +1,5 @@
# coding=utf-8
-id = 198
name = 'Top shop'
slug = 'Top shop'
diff --git a/python/problems/while_and_if/top_shop/sl.py b/python/problems/while_and_if/top_shop/sl.py
index ee9d02d..334736c 100644
--- a/python/problems/while_and_if/top_shop/sl.py
+++ b/python/problems/while_and_if/top_shop/sl.py
@@ -2,7 +2,6 @@
import server
mod = server.problems.load_language('python', 'sl')
-id = 198
name = 'Blagajna "top shop"'
slug = 'Blagajna "top shop"'
@@ -24,7 +23,7 @@ Poprečna cena: 2.33333333333
'''
main_plan = ['''\
-<p><b>Plan:</b></p>
+<p>Plan:</p>
<pre>
1. Ponavljaj dokler je cena večja od 0:
2. Preberi ceno.
@@ -94,7 +93,8 @@ while cena != 0:
...'''],
'final_hint': ['''\
-<p><b>Odlično!</b> Kaj bi pa moral narediti, da bi število -1 pomenilo konec?</p>''',
+<p>Odlično, program je pravilen! <br>
+Kaj bi pa moral narediti, da bi število -1 pomenilo konec?</p>''',
'''\
<p>Spremeniti pogoj in paziti,
da se vrednost -1 ne prišteje vsoti!</p>'''],