summaryrefslogtreecommitdiff
path: root/python/problems/functions/greatest_absolutist
diff options
context:
space:
mode:
Diffstat (limited to 'python/problems/functions/greatest_absolutist')
-rw-r--r--python/problems/functions/greatest_absolutist/common.py5
-rw-r--r--python/problems/functions/greatest_absolutist/en.py1
-rw-r--r--python/problems/functions/greatest_absolutist/sl.py3
3 files changed, 5 insertions, 4 deletions
diff --git a/python/problems/functions/greatest_absolutist/common.py b/python/problems/functions/greatest_absolutist/common.py
index 2d80097..3226b87 100644
--- a/python/problems/functions/greatest_absolutist/common.py
+++ b/python/problems/functions/greatest_absolutist/common.py
@@ -6,7 +6,6 @@ from python.util import has_token_sequence, string_almost_equal, \
from server.hints import Hint
id = 196
-group = 'functions'
number = 2
visible = True
@@ -35,6 +34,10 @@ hint_type = {
def test(python, code):
+ tokens = get_tokens(code)
+ if not has_token_sequence(tokens, ['def', 'max_abs']):
+ return False, [{'id' : 'no_func_name', 'args' : {'func_name' : 'max_abs'}}]
+
test_lists = [[6, 4, 2, 0],
[4, 6, 2, 0],
[4, 2, 6, 0],
diff --git a/python/problems/functions/greatest_absolutist/en.py b/python/problems/functions/greatest_absolutist/en.py
index 03614e7..1ede4a9 100644
--- a/python/problems/functions/greatest_absolutist/en.py
+++ b/python/problems/functions/greatest_absolutist/en.py
@@ -1,6 +1,5 @@
# coding=utf-8
-id = 196
name = 'Greatest absolutist'
slug = 'Greatest absolutist'
diff --git a/python/problems/functions/greatest_absolutist/sl.py b/python/problems/functions/greatest_absolutist/sl.py
index d51cd96..a45f483 100644
--- a/python/problems/functions/greatest_absolutist/sl.py
+++ b/python/problems/functions/greatest_absolutist/sl.py
@@ -3,7 +3,6 @@ import server
mod = server.problems.load_language('python', 'sl')
-id = 196
name = 'Največji absolutist'
slug = 'Največji absolutist'
@@ -101,7 +100,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>''',
}