summaryrefslogtreecommitdiff
path: root/python/problems/functions
diff options
context:
space:
mode:
Diffstat (limited to 'python/problems/functions')
-rw-r--r--python/problems/functions/assign_numbers/common.py47
-rw-r--r--python/problems/functions/assign_numbers/en.py16
-rw-r--r--python/problems/functions/assign_numbers/sl.py34
-rw-r--r--python/problems/functions/body_mass_index/common.py47
-rw-r--r--python/problems/functions/body_mass_index/en.py16
-rw-r--r--python/problems/functions/body_mass_index/sl.py35
-rw-r--r--python/problems/functions/body_mass_index_2/common.py47
-rw-r--r--python/problems/functions/body_mass_index_2/en.py16
-rw-r--r--python/problems/functions/body_mass_index_2/sl.py34
-rw-r--r--python/problems/functions/divisors/common.py46
-rw-r--r--python/problems/functions/divisors/en.py16
-rw-r--r--python/problems/functions/divisors/sl.py26
-rw-r--r--python/problems/functions/divisors_sum/common.py48
-rw-r--r--python/problems/functions/divisors_sum/en.py16
-rw-r--r--python/problems/functions/divisors_sum/sl.py27
-rw-r--r--python/problems/functions/friendly_numbers/common.py53
-rw-r--r--python/problems/functions/friendly_numbers/en.py16
-rw-r--r--python/problems/functions/friendly_numbers/sl.py37
-rw-r--r--python/problems/functions/greatest_absolutist/sl.py2
-rw-r--r--python/problems/functions/palindrome/common.py44
-rw-r--r--python/problems/functions/palindrome/en.py16
-rw-r--r--python/problems/functions/palindrome/sl.py33
-rw-r--r--python/problems/functions/palindromic_numbers/common.py49
-rw-r--r--python/problems/functions/palindromic_numbers/en.py16
-rw-r--r--python/problems/functions/palindromic_numbers/sl.py31
-rw-r--r--python/problems/functions/perfect_numbers/common.py51
-rw-r--r--python/problems/functions/perfect_numbers/en.py16
-rw-r--r--python/problems/functions/perfect_numbers/sl.py30
-rw-r--r--python/problems/functions/prime_numbers/common.py49
-rw-r--r--python/problems/functions/prime_numbers/en.py16
-rw-r--r--python/problems/functions/prime_numbers/sl.py27
31 files changed, 956 insertions, 1 deletions
diff --git a/python/problems/functions/assign_numbers/common.py b/python/problems/functions/assign_numbers/common.py
new file mode 100644
index 0000000..f00305a
--- /dev/null
+++ b/python/problems/functions/assign_numbers/common.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+
+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
+
+id = 225
+group = 'lists_and_for'
+number = 4
+visible = True
+
+solution = '''\
+def numbers(xs):
+ ys = []
+ for i in range(len(xs)):
+ ys.append((i, xs[i]))
+ return ys
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/assign_numbers/en.py b/python/problems/functions/assign_numbers/en.py
new file mode 100644
index 0000000..a68c6c8
--- /dev/null
+++ b/python/problems/functions/assign_numbers/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 225
+name = 'Assign numbers'
+slug = 'Assign numbers'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/assign_numbers/sl.py b/python/problems/functions/assign_numbers/sl.py
new file mode 100644
index 0000000..97c0c3a
--- /dev/null
+++ b/python/problems/functions/assign_numbers/sl.py
@@ -0,0 +1,34 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 225
+name = 'Oštevilči'
+slug = 'Oštevilči'
+
+
+description = '''\
+<p>
+Napišite funkcijo <code>numbers(xs)</code>, ki vrne seznam oblike <code>[(0, xs[0]), (1, xs[1]), ..., (n, xs[n])]</code>.
+Število <code>n</code> je enako dolžini seznama <code>xs</code> minus ena.
+<pre>
+>>> numbers([4, 4, 4])
+[(0, 4), (1, 4), (2, 4)]
+>>> numbers([5, 1, 4, 2, 3])
+[(0, 5), (1, 1), (2, 4), (3, 2), (4, 3)]
+</pre>
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/body_mass_index/common.py b/python/problems/functions/body_mass_index/common.py
new file mode 100644
index 0000000..fba7570
--- /dev/null
+++ b/python/problems/functions/body_mass_index/common.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+
+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
+
+id = 226
+group = 'functions'
+number = 5
+visible = True
+
+solution = '''\
+def bmi(xs):
+ ys = []
+ for name, weight, height in xs:
+ ys.append((name, weight / (height / 100)**2))
+ return ys
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/body_mass_index/en.py b/python/problems/functions/body_mass_index/en.py
new file mode 100644
index 0000000..fb4663f
--- /dev/null
+++ b/python/problems/functions/body_mass_index/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 226
+name = 'Body mass index'
+slug = 'Body mass index'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/body_mass_index/sl.py b/python/problems/functions/body_mass_index/sl.py
new file mode 100644
index 0000000..fd67c88
--- /dev/null
+++ b/python/problems/functions/body_mass_index/sl.py
@@ -0,0 +1,35 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 226
+name = 'Indeks telesne teže'
+slug = 'Indeks telesne teže'
+
+
+description = '''\
+<p>
+Podan imamo seznam trojk: ime osebe, teža, višina, na primer:
+<pre>
+>>> osebe = [('Ana', 55, 165), ('Berta', 60, 153)]
+</pre>
+Napišite funkcijo <code>bmi(osebe)</code>, ki na podlagi podanega seznama osebe, sestavi seznam dvojk: ime osebe, indeks telesne teže:
+<pre>
+>>> bmi(osebe)
+[('Ana', 20.202020202020204), ('Berta', 25.63116749967961)]
+</pre>
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/body_mass_index_2/common.py b/python/problems/functions/body_mass_index_2/common.py
new file mode 100644
index 0000000..58c7ab1
--- /dev/null
+++ b/python/problems/functions/body_mass_index_2/common.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+
+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
+
+id = 226
+group = 'functions'
+number = 6
+visible = True
+
+solution = '''\
+def bmi2(names, weights, heights):
+ ys = []
+ for name, weight, height in zip(names, weights, heights):
+ ys.append((name, weight / (height / 100)**2))
+ return ys
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/body_mass_index_2/en.py b/python/problems/functions/body_mass_index_2/en.py
new file mode 100644
index 0000000..8ce2533
--- /dev/null
+++ b/python/problems/functions/body_mass_index_2/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 226
+name = 'Body mass index 2'
+slug = 'Body mass index 2'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/body_mass_index_2/sl.py b/python/problems/functions/body_mass_index_2/sl.py
new file mode 100644
index 0000000..21e7fa0
--- /dev/null
+++ b/python/problems/functions/body_mass_index_2/sl.py
@@ -0,0 +1,34 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 226
+name = 'Indeks telesne teže 2'
+slug = 'Indeks telesne teže 2'
+
+
+description = '''\
+<p>
+Naloga je podobna prejšnji, le da imamo tokrat podatke v drugačni obliki:
+<pre>
+>>> imena = ['Ana', 'Berta']
+>>> teze = [55, 60]
+>>> visine = [165, 153]
+>>> bmi2(imena, teze, visine)
+[('Ana', 20.202020202020204), ('Berta', 25.63116749967961)]
+</pre>
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/divisors/common.py b/python/problems/functions/divisors/common.py
new file mode 100644
index 0000000..c3e71d8
--- /dev/null
+++ b/python/problems/functions/divisors/common.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+
+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
+
+id = 230
+group = 'functions'
+number = 9
+visible = True
+
+solution = '''\
+def divisors(n):
+ for i in range(1, n):
+ if n % i == 0:
+ print(i)
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/divisors/en.py b/python/problems/functions/divisors/en.py
new file mode 100644
index 0000000..d1e71c2
--- /dev/null
+++ b/python/problems/functions/divisors/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 230
+name = 'Divisors'
+slug = 'Divisors'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/divisors/sl.py b/python/problems/functions/divisors/sl.py
new file mode 100644
index 0000000..76b0917
--- /dev/null
+++ b/python/problems/functions/divisors/sl.py
@@ -0,0 +1,26 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 230
+name = 'Delitelji'
+slug = 'Delitelji'
+
+
+description = '''\
+<p>
+Napiši funkcijo <code>divisors(n)</code>, ki izpiše vse delitelje števila (brez samega sebe), ki ga vnese uporabnik.</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/divisors_sum/common.py b/python/problems/functions/divisors_sum/common.py
new file mode 100644
index 0000000..d6a2b88
--- /dev/null
+++ b/python/problems/functions/divisors_sum/common.py
@@ -0,0 +1,48 @@
+# coding=utf-8
+
+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
+
+id = 231
+group = 'functions'
+number = 10
+visible = True
+
+solution = '''\
+def divisors_sum(n):
+ s = 0
+ for i in range(1, n):
+ if n % i == 0:
+ s += i
+ return s
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/divisors_sum/en.py b/python/problems/functions/divisors_sum/en.py
new file mode 100644
index 0000000..67806f7
--- /dev/null
+++ b/python/problems/functions/divisors_sum/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 231
+name = 'Divisors sum'
+slug = 'Divisors sum'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/divisors_sum/sl.py b/python/problems/functions/divisors_sum/sl.py
new file mode 100644
index 0000000..47b8719
--- /dev/null
+++ b/python/problems/functions/divisors_sum/sl.py
@@ -0,0 +1,27 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 231
+name = 'Vsota deliteljev'
+slug = 'Vsota deliteljev'
+
+
+description = '''\
+<p>
+Napiši funkcijo <code>divisors_sum(n)</code>, ki vrne vsoto vseh deliteljev števila, ki ga vnese uporabnik.
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/friendly_numbers/common.py b/python/problems/functions/friendly_numbers/common.py
new file mode 100644
index 0000000..415040e
--- /dev/null
+++ b/python/problems/functions/friendly_numbers/common.py
@@ -0,0 +1,53 @@
+# coding=utf-8
+
+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
+
+id = 233
+group = 'functions'
+number = 12
+visible = True
+
+solution = '''\
+def divisors_sum(n):
+ s = 0
+ for i in range(1, n):
+ if n % i == 0:
+ s += i
+ return s
+
+def friendly_number(n):
+ s = divisors_sum(n)
+ if n == divisors_sum(s):
+ return s
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/friendly_numbers/en.py b/python/problems/functions/friendly_numbers/en.py
new file mode 100644
index 0000000..ba740ae
--- /dev/null
+++ b/python/problems/functions/friendly_numbers/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 233
+name = 'Friendly numbers'
+slug = 'Friendly numbers'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/friendly_numbers/sl.py b/python/problems/functions/friendly_numbers/sl.py
new file mode 100644
index 0000000..d1c15ff
--- /dev/null
+++ b/python/problems/functions/friendly_numbers/sl.py
@@ -0,0 +1,37 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 233
+name = 'Prijateljska števila'
+slug = 'Prijateljska števila'
+
+
+description = '''\
+<p>
+220 in 284 sta prijateljski števili. Delitelji 220 so 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 in 110.
+Če jih seštejemo, dobimo 284. Delitelji 284 pa so 1, 2, 4, 71 in 142. Vsota teh števil pa je 220.
+Napiši funkcijo <code>friendly_number(n)</code>, ki vrne prijateljsko število številu <code>n</code>, če ga ima, oz.
+vrne <code>None</code>, če ga nima. Primer:
+<pre>
+>>> friendly_number(220)
+284
+>>> friendly_number(222)
+None
+</pre>
+</p>
+<p> Uporabite funkcijo za vsoto deliteljev!</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/greatest_absolutist/sl.py b/python/problems/functions/greatest_absolutist/sl.py
index d51cd96..ee33c6d 100644
--- a/python/problems/functions/greatest_absolutist/sl.py
+++ b/python/problems/functions/greatest_absolutist/sl.py
@@ -101,7 +101,7 @@ V tem primeru se lahko zgodi, da se zanka ne izteče do konca.</p>''',
Tudi to nalogo lahko rešimo s funkcijo <code>max</code>:</p>
<pre>
def max_abs(xs):
- return max(xs, key = lambda x: abs(x))
+ return max(xs, key = abs(x))
</pre>''',
}
diff --git a/python/problems/functions/palindrome/common.py b/python/problems/functions/palindrome/common.py
new file mode 100644
index 0000000..e012e8d
--- /dev/null
+++ b/python/problems/functions/palindrome/common.py
@@ -0,0 +1,44 @@
+# coding=utf-8
+
+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
+
+id = 228
+group = 'functions'
+number = 7
+visible = True
+
+solution = '''\
+def palindrome(s):
+ return s == s[::-1]
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/palindrome/en.py b/python/problems/functions/palindrome/en.py
new file mode 100644
index 0000000..784c395
--- /dev/null
+++ b/python/problems/functions/palindrome/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 228
+name = 'Palindrome'
+slug = 'Palindrome'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/palindrome/sl.py b/python/problems/functions/palindrome/sl.py
new file mode 100644
index 0000000..e005057
--- /dev/null
+++ b/python/problems/functions/palindrome/sl.py
@@ -0,0 +1,33 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 228
+name = 'Palindrom'
+slug = 'Palindrom'
+
+
+description = '''\
+<p>
+Napišite funkcijo <code>palindrome(s)</code>, ki preveri, ali je niz s palindrom.
+<pre>
+>>> palindrome('pericarezeracirep')
+True
+>>> palindrome('perica')
+False
+</pre>
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/palindromic_numbers/common.py b/python/problems/functions/palindromic_numbers/common.py
new file mode 100644
index 0000000..ba518c7
--- /dev/null
+++ b/python/problems/functions/palindromic_numbers/common.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+
+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
+
+id = 229
+group = 'functions'
+number = 8
+visible = True
+
+solution = '''\
+def palindromic_numbers():
+ xs = []
+ for i in range(100, 1000):
+ for j in range(100, 1000):
+ if str(i * j) == str(i * j)[::-1]:
+ xs.append(i * j)
+ return max(xs)
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/palindromic_numbers/en.py b/python/problems/functions/palindromic_numbers/en.py
new file mode 100644
index 0000000..5f4ea76
--- /dev/null
+++ b/python/problems/functions/palindromic_numbers/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 229
+name = 'Palindromic numbers'
+slug = 'Palindromic numbers'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/palindromic_numbers/sl.py b/python/problems/functions/palindromic_numbers/sl.py
new file mode 100644
index 0000000..8d64bab
--- /dev/null
+++ b/python/problems/functions/palindromic_numbers/sl.py
@@ -0,0 +1,31 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 229
+name = 'Palindromska števila'
+slug = 'Palindromska števila'
+
+
+description = '''\
+<p>
+Največje palindromsko število, ki ga lahko dobimo kot produkt dveh dvomestnih števil je <code>9009 = 91 * 99</code>.
+Napišite funkcijo <code>palindromic_number()</code>, ki poišče in vrne največje palindromsko število,
+ki ga lahko dobimo kot produkt dveh tromestnih števil.
+
+Vir: Project Euler, <a href="http://projecteuler.net/index.php?section=problems&id=4">Problem 4</a>.
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/perfect_numbers/common.py b/python/problems/functions/perfect_numbers/common.py
new file mode 100644
index 0000000..ad1a7cd
--- /dev/null
+++ b/python/problems/functions/perfect_numbers/common.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+
+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
+
+id = 232
+group = 'functions'
+number = 11
+visible = True
+
+solution = '''\
+def divisors_sum(n):
+ s = 0
+ for i in range(1, n):
+ if n % i == 0:
+ s += i
+ return s
+
+def perfect(n):
+ return n == divisors_sum(n)
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/perfect_numbers/en.py b/python/problems/functions/perfect_numbers/en.py
new file mode 100644
index 0000000..a7cb94e
--- /dev/null
+++ b/python/problems/functions/perfect_numbers/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 232
+name = 'Perfect numbers'
+slug = 'Perfect numbers'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/perfect_numbers/sl.py b/python/problems/functions/perfect_numbers/sl.py
new file mode 100644
index 0000000..a354a17
--- /dev/null
+++ b/python/problems/functions/perfect_numbers/sl.py
@@ -0,0 +1,30 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 232
+name = 'Popolna števila'
+slug = 'Popolna števila'
+
+
+description = '''\
+<p>
+Napiši funkcijo <code>perfect(n)</code>, ki vrne <code>True</code>, če je podano število popolno, oz. <code>False</code>, če ni.
+Popolna števila so števila, ki so enaka vsoti svojih deliteljev (brez samega sebe).
+Primer popolnega števila je 28, saj so njegovi delitelji 1, 2, 4, 7, 14, njihova vsota, 1+2+4+7+14 pa je spet enaka 28.
+</p>
+<p> Uporabite funkcijo za vsoto deliteljev!</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}
diff --git a/python/problems/functions/prime_numbers/common.py b/python/problems/functions/prime_numbers/common.py
new file mode 100644
index 0000000..0447c61
--- /dev/null
+++ b/python/problems/functions/prime_numbers/common.py
@@ -0,0 +1,49 @@
+# coding=utf-8
+
+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
+
+id = 234
+group = 'functions'
+number = 13
+visible = True
+
+solution = '''\
+def prime(n):
+ for i in range(2, n):
+ for j in range(2, i):
+ if i % j == 0:
+ break
+ else:
+ print(i)
+'''
+
+hint_type = {
+ 'final_hint': Hint('final_hint')
+}
+
+def test(python, code):
+ test_in = [1]
+ n_correct = 0
+
+ passed = n_correct == len(test_in)
+ tin = None
+ tout = None
+ 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):
+ tokens = get_tokens(code)
+
+ # run one test first to see if there are any exceptions
+ answer = python(code=code, inputs=[(None, None)], timeout=1.0)
+ exc = get_exception_desc(answer[0][3])
+ if exc: return exc
+
+ return None
diff --git a/python/problems/functions/prime_numbers/en.py b/python/problems/functions/prime_numbers/en.py
new file mode 100644
index 0000000..87c01a2
--- /dev/null
+++ b/python/problems/functions/prime_numbers/en.py
@@ -0,0 +1,16 @@
+# coding=utf-8
+
+id = 234
+name = 'Prime numbers'
+slug = 'Prime numbers'
+
+description = '''\
+<p>(translation missing)</p>'''
+
+hint = {
+ 'plan': '''\
+<p>(translation missing)</p>''',
+
+ 'no_input_call': '''\
+<p>(translation missing)</p>''',
+}
diff --git a/python/problems/functions/prime_numbers/sl.py b/python/problems/functions/prime_numbers/sl.py
new file mode 100644
index 0000000..f6c6b24
--- /dev/null
+++ b/python/problems/functions/prime_numbers/sl.py
@@ -0,0 +1,27 @@
+# coding=utf-8
+import server
+mod = server.problems.load_language('python', 'sl')
+
+
+id = 234
+name = 'Praštevila'
+slug = 'Praštevila'
+
+
+description = '''\
+<p>
+Napišite funkcijo <code>prime(n)</code>, ki izpiše vsa praštevila manjša od <code>n</code>.
+</p>'''
+
+plan = ['''\
+<p></p>
+''',
+ '''\
+<p></p>''']
+
+hint = {
+ 'final_hint': ['''\
+<p>Program je pravilen! <br>
+</p>
+'''],
+}