From fc34673e84ea9bc823e8530c7564f0caa6a99000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= Date: Tue, 27 Sep 2016 16:38:23 +0200 Subject: Added exercises with list comprehensions. --- python/problems/comprehensions/std/sl.py | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 python/problems/comprehensions/std/sl.py (limited to 'python/problems/comprehensions/std/sl.py') diff --git a/python/problems/comprehensions/std/sl.py b/python/problems/comprehensions/std/sl.py new file mode 100644 index 0000000..ae6e0af --- /dev/null +++ b/python/problems/comprehensions/std/sl.py @@ -0,0 +1,41 @@ +import server +mod = server.problems.load_language('python', 'sl') + + +id = 20704 +name = 'Standardni odklon' + +description = '''\ +

+Napišite funkcijo std(xs), ki izračuna +standardni odklon populacije xs. Formulo za standardno deviacijo je +\[ \sigma = \sqrt{ \\frac{1}{N}\sum_{i=1}^{N} \left(x_i - \mu \\right)^2} \], +Vrednost \( \mu \) je povprečna vrednost populacije. +

+
+>>> xs = [183, 168, 175, 176, 192, 180]
+>>> std(xs)
+7.43863786814
+
+''' + +plan = [] + +hint = { + 'final_hint': ['''\ +

Program je pravilen!
+

+'''], + + 'no_comprehension': ['''\ +

Program je sicer pravilen, vendar ne vsebuje izpeljanih seznamov ali +generatorjev... +

+'''], + + 'has_loop': ['''\ +

Program je sicer pravilen, vendar vsebuje zanko. +

+'''], + +} -- cgit v1.2.1