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/functions/greatest_absolutist/en.py | 1 - python/problems/functions/greatest_absolutist/sl.py | 1 - 2 files changed, 2 deletions(-) (limited to 'python/problems/functions/greatest_absolutist') 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..45440b2 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' -- 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/functions/greatest_absolutist/sl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/problems/functions/greatest_absolutist') 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.

''', Tudi to nalogo lahko rešimo s funkcijo max:

 def max_abs(xs):
-    return max(xs, key = lambda x: abs(x))
+    return max(xs, key = abs(x))
 
''', } -- 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/functions/greatest_absolutist/common.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'python/problems/functions/greatest_absolutist') diff --git a/python/problems/functions/greatest_absolutist/common.py b/python/problems/functions/greatest_absolutist/common.py index 2d80097..564d0c8 100644 --- a/python/problems/functions/greatest_absolutist/common.py +++ b/python/problems/functions/greatest_absolutist/common.py @@ -35,6 +35,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], -- 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/functions/greatest_absolutist/common.py | 1 - 1 file changed, 1 deletion(-) (limited to 'python/problems/functions/greatest_absolutist') diff --git a/python/problems/functions/greatest_absolutist/common.py b/python/problems/functions/greatest_absolutist/common.py index 564d0c8..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 -- cgit v1.2.1