From bab0b0a2fe8b3aad853740750d4873fb929f5f41 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 7 Oct 2015 16:07:05 +0200 Subject: Remove bold text since it looked strange. --- python/problems/while_and_if/buy_five/sl.py | 12 ++++++------ python/problems/while_and_if/checking_account/sl.py | 4 ++-- python/problems/while_and_if/competition/sl.py | 6 +++--- python/problems/while_and_if/consumers_anonymous/common.py | 2 +- python/problems/while_and_if/consumers_anonymous/sl.py | 10 +++++----- python/problems/while_and_if/minimax/common.py | 2 +- python/problems/while_and_if/minimax/sl.py | 2 +- python/problems/while_and_if/top_shop/common.py | 2 +- python/problems/while_and_if/top_shop/sl.py | 5 +++-- 9 files changed, 23 insertions(+), 22 deletions(-) (limited to 'python/problems/while_and_if') diff --git a/python/problems/while_and_if/buy_five/sl.py b/python/problems/while_and_if/buy_five/sl.py index 22fa7b4..8008d91 100644 --- a/python/problems/while_and_if/buy_five/sl.py +++ b/python/problems/while_and_if/buy_five/sl.py @@ -22,7 +22,7 @@ Vsota: 16 ''' bad_solution = ['''\ -

Primer, kako NE reševati +

Primer, kako NE reševati

 cena1 = float(input('Cena artikla: '))
 cena2 = float(input('Cena artikla: '))
@@ -36,7 +36,7 @@ print ("Vsota: " + vsota)
 

Rešitev je slaba, saj imamo pet enakih vrstic! Uporabite zanko!

'''] main_plan = ['''\ -

Plan:

+

Plan:

 1. Ponavljaj 5x:
     2. Preberi ceno.
@@ -45,9 +45,9 @@ main_plan = ['''\
 
'''] while_clause = ['''\ -

Kako bi nekaj 5x ponovil?

''', +

Uporabi zanko while.

''', '''\ -

Zanka while ima naslednjo sintakso:

+

Zanka while ima naslednjo sintakso:

 while Pogoj:
     stavek 1
@@ -62,7 +62,7 @@ našem primeru s stavkom n.

''' ] reading_while = ['''\ -

Za večkratno branje želimo uporabiti zanko

''', +

Za večkratno branje želimo uporabiti zanko

''', '''\
@@ -94,7 +94,7 @@ while stevec < 5:
 ''']
 
 summation = ['''\
-

Računanje vsote bo najlažje sproti v zanki.

''', +

Računaj vsoto sproti v zanki.

''', '''\

Izmisli si spremenljivko, ki bo predstavljala vsoto, jo na diff --git a/python/problems/while_and_if/checking_account/sl.py b/python/problems/while_and_if/checking_account/sl.py index 2825431..91a877c 100644 --- a/python/problems/while_and_if/checking_account/sl.py +++ b/python/problems/while_and_if/checking_account/sl.py @@ -11,7 +11,7 @@ description = '''\

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č.

+stanje in se ustavi, ko je uporabnik v minusu za 100 evrov ali več. Takrat naj program izpiše "Bankrot".

 Sprememba 23
 Stanje 23
@@ -32,7 +32,7 @@ Bankrot
 '''
 
 main_plan = ['''\
-

Plan

je enak kot pri prejšnjih nalogah, le vsebina je drugačna: +

Plan je enak kot pri prejšnjih nalogah, le vsebina je drugačna:

 1.Ponavljaj dokler ni bankrot
     2.Preberi ceno
diff --git a/python/problems/while_and_if/competition/sl.py b/python/problems/while_and_if/competition/sl.py
index 8d01ad4..2fedf14 100644
--- a/python/problems/while_and_if/competition/sl.py
+++ b/python/problems/while_and_if/competition/sl.py
@@ -21,7 +21,7 @@ Vsota: 7
 
''' main_plan = ['''\ -

Plan bo enak kot pri prejšnji nalogi, +

Plan bo enak kot pri prejšnji nalogi, le število ponavljanj se spremeni.

''', '''\
@@ -35,7 +35,7 @@ plan = [main_plan]
 
 
 while_clause = ['''\
-

Kako bi prebral 5 cen z uporabo zanke while?

''', +

Kako bi prebral N cen z uporabo zanke while?

''', '''\

Zanka while ima naslednjo sintakso:

@@ -52,7 +52,7 @@ našem primeru s stavkom n.

''' ] summation = ['''\ -

Računanje vsote bo najlažje sproti v zanki.

''', +

Računaj vsoto sproti v zanki.

''', '''\

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..b955f49 100644 --- a/python/problems/while_and_if/consumers_anonymous/common.py +++ b/python/problems/while_and_if/consumers_anonymous/common.py @@ -111,7 +111,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/sl.py b/python/problems/while_and_if/consumers_anonymous/sl.py index 284abbc..cc5bcb7 100644 --- a/python/problems/while_and_if/consumers_anonymous/sl.py +++ b/python/problems/while_and_if/consumers_anonymous/sl.py @@ -46,17 +46,17 @@ Porabili boste 10 evrov za 10 stvari. ''' main_plan = ['''\ -

Plan je enak kot pri prejšnjih nalogah: while zanka + izpis števca in vsote.

+

Plan je enak kot pri prejšnjih nalogah: while zanka + izpis števca in vsote.

'''] while_condition = ['''\ -

Pogoj v zanki while bo sestavljen iz več pogojev.

''', +

Pogoj v zanki while bo sestavljen iz več pogojev.

''', '''\

V Pythonu združujemo pogoje z logičnimi operatoriji and, or in not

''' '''\

Zanka se ustavi, če presežemo 100 EUR, če smo vpisali 0 ali kupili 10 stvari. -Vendar pazite: napisati moramo pogoj, kdaj se zanka nadaljuje!

''', +Vendar pazite: napisati moramo pogoj, kdaj se zanka nadaljuje!

''', '''\
 cena != 0 and vsota < 100 and artiklov < 10
@@ -110,10 +110,10 @@ hint = {
 Pravilna vsota [%=sum%], pravilno število stvari: [%=count%]'''],
 
     'final_hint': ['''\
-

Odlično! Naloga rešena.

+

Odlično! Naloga rešena.
Š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): -cena > 0 and stevec < 10 and vsota < 100. Temu pravimo De Morganov zakon. +cena > 0 and stevec < 10 and vsota < 100. Temu pravimo De Morganov zakon.

'''], '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..dcfb311 100644 --- a/python/problems/while_and_if/minimax/common.py +++ b/python/problems/while_and_if/minimax/common.py @@ -60,7 +60,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/sl.py b/python/problems/while_and_if/minimax/sl.py index a76bd2e..2b07efa 100644 --- a/python/problems/while_and_if/minimax/sl.py +++ b/python/problems/while_and_if/minimax/sl.py @@ -22,7 +22,7 @@ Najvišja cena: 4 ''' main_plan = ['''\ -

Plan:

+

Plan:

 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..887d43e 100644
--- a/python/problems/while_and_if/top_shop/common.py
+++ b/python/problems/while_and_if/top_shop/common.py
@@ -55,7 +55,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/sl.py b/python/problems/while_and_if/top_shop/sl.py
index ee9d02d..b577633 100644
--- a/python/problems/while_and_if/top_shop/sl.py
+++ b/python/problems/while_and_if/top_shop/sl.py
@@ -24,7 +24,7 @@ Poprečna cena: 2.33333333333
 '''
 
 main_plan = ['''\
-

Plan:

+

Plan:

 1. Ponavljaj dokler je cena večja od 0:
     2. Preberi ceno.
@@ -94,7 +94,8 @@ while cena != 0:
     ...'''],
 
     'final_hint': ['''\
-

Odlično! Kaj bi pa moral narediti, da bi število -1 pomenilo konec?

''', +

Odlično, program je pravilen!
+Kaj bi pa moral narediti, da bi število -1 pomenilo konec?

''', '''\

Spremeniti pogoj in paziti, da se vrednost -1 ne prišteje vsoti!

'''], -- cgit v1.2.1 From ce3b6703c153ba5c827996bfa8fd9bfa85fe2adb Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 8 Oct 2015 16:02:17 +0200 Subject: Remove unneeded id field from {en,sl}.py files --- python/problems/while_and_if/buy_five/en.py | 1 - python/problems/while_and_if/buy_five/sl.py | 1 - python/problems/while_and_if/checking_account/en.py | 1 - python/problems/while_and_if/checking_account/sl.py | 1 - python/problems/while_and_if/competition/en.py | 1 - python/problems/while_and_if/competition/sl.py | 1 - python/problems/while_and_if/consumers_anonymous/en.py | 1 - python/problems/while_and_if/consumers_anonymous/sl.py | 1 - python/problems/while_and_if/minimax/en.py | 1 - python/problems/while_and_if/minimax/sl.py | 1 - python/problems/while_and_if/top_shop/en.py | 1 - python/problems/while_and_if/top_shop/sl.py | 1 - 12 files changed, 12 deletions(-) (limited to 'python/problems/while_and_if') 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 8008d91..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"' diff --git a/python/problems/while_and_if/checking_account/en.py b/python/problems/while_and_if/checking_account/en.py index 1d36474..12ecf28 100644 --- a/python/problems/while_and_if/checking_account/en.py +++ b/python/problems/while_and_if/checking_account/en.py @@ -1,6 +1,5 @@ # coding=utf-8 -id = 199 name = 'Checking Account' slug = 'Checking Account' diff --git a/python/problems/while_and_if/checking_account/sl.py b/python/problems/while_and_if/checking_account/sl.py index 91a877c..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' 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 2fedf14..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"' diff --git a/python/problems/while_and_if/consumers_anonymous/en.py b/python/problems/while_and_if/consumers_anonymous/en.py index 6331570..49fe465 100644 --- a/python/problems/while_and_if/consumers_anonymous/en.py +++ b/python/problems/while_and_if/consumers_anonymous/en.py @@ -2,7 +2,6 @@ import server mod = server.problems.load_language('python', 'sl') -id = 201 name = 'Consumers Anonymous' slug = 'Consumers Anonymous' diff --git a/python/problems/while_and_if/consumers_anonymous/sl.py b/python/problems/while_and_if/consumers_anonymous/sl.py index cc5bcb7..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' 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 2b07efa..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"' 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 b577633..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"' -- cgit v1.2.1 From 3d0fde9ac8bc568845cfef8391ea0f9b0fe2f4e6 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 8 Oct 2015 16:13:35 +0200 Subject: Add language/group IDs and group numbers for Prolog --- python/problems/while_and_if/common.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 python/problems/while_and_if/common.py (limited to 'python/problems/while_and_if') diff --git a/python/problems/while_and_if/common.py b/python/problems/while_and_if/common.py new file mode 100644 index 0000000..3ca8844 --- /dev/null +++ b/python/problems/while_and_if/common.py @@ -0,0 +1 @@ +id = 14 -- cgit v1.2.1 From 84f3426c937d1bb9d44ba25a71706416fbb8b85d Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 9 Oct 2015 11:17:49 +0200 Subject: Added several new problems. They have no tests nor hints implemented. --- python/problems/while_and_if/checking_account/en.py | 4 ++-- python/problems/while_and_if/consumers_anonymous/en.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'python/problems/while_and_if') 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 = '''\

(translation missing)

''' 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 = '''\

(translation missing)

''' -- cgit v1.2.1 From 95e107bf9e6a288969e4a83aee1a7062990f3b67 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 9 Oct 2015 16:35:23 +0200 Subject: Fixed testing for most problems. --- python/problems/while_and_if/common.py | 1 + 1 file changed, 1 insertion(+) (limited to 'python/problems/while_and_if') diff --git a/python/problems/while_and_if/common.py b/python/problems/while_and_if/common.py index 3ca8844..c4071df 100644 --- a/python/problems/while_and_if/common.py +++ b/python/problems/while_and_if/common.py @@ -1 +1,2 @@ id = 14 +number = 2 \ No newline at end of file -- cgit v1.2.1 From 6e281624b9a0ae29f1f1862f9d581b219ba3b95a Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 12 Oct 2015 11:46:08 +0200 Subject: Remove group attribute from problem common.py files --- python/problems/while_and_if/buy_five/common.py | 1 - python/problems/while_and_if/checking_account/common.py | 1 - python/problems/while_and_if/competition/common.py | 1 - python/problems/while_and_if/consumers_anonymous/common.py | 1 - python/problems/while_and_if/minimax/common.py | 1 - python/problems/while_and_if/top_shop/common.py | 1 - 6 files changed, 6 deletions(-) (limited to 'python/problems/while_and_if') 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/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/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/consumers_anonymous/common.py b/python/problems/while_and_if/consumers_anonymous/common.py index b955f49..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 diff --git a/python/problems/while_and_if/minimax/common.py b/python/problems/while_and_if/minimax/common.py index dcfb311..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 diff --git a/python/problems/while_and_if/top_shop/common.py b/python/problems/while_and_if/top_shop/common.py index 887d43e..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 -- cgit v1.2.1