From ed5473c15bdb472219056b30850605cf7e3b9a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= Date: Mon, 26 Oct 2015 17:50:22 +0100 Subject: Corrected tests in for-loop problems. Fixed some typos. --- python/problems/functions/assign_numbers/sl.py | 36 ++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'python/problems/functions/assign_numbers') diff --git a/python/problems/functions/assign_numbers/sl.py b/python/problems/functions/assign_numbers/sl.py index 97c0c3a..767e045 100644 --- a/python/problems/functions/assign_numbers/sl.py +++ b/python/problems/functions/assign_numbers/sl.py @@ -10,7 +10,7 @@ slug = 'Oštevilči' description = '''\

-Napišite funkcijo numbers(xs), ki vrne seznam oblike [(0, xs[0]), (1, xs[1]), ..., (n, xs[n])]. +Napiši funkcijo numbers(xs), ki vrne seznam oblike [(0, xs[0]), (1, xs[1]), ..., (n, xs[n])]. Število n je enako dolžini seznama xs minus ena.

 >>> numbers([4, 4, 4])
@@ -20,11 +20,37 @@ Napišite funkcijo numbers(xs), ki vrne seznam oblike [(0, xs
 

''' -plan = ['''\ -

-''', +range_function = [ '''\ -

'''] +

+Uporabi funkcijo range. +

''', + '''\ +

Poskusi, kaj naredi naslednji program:

+
+xs = [2,3,4,5]
+for i in range(len(xs)):
+    print (i, xs[i])
+
'''] + +tuples = [ + '''\ +

+Več elementov skupaj v navadnih oklepajih imenujemo terka oz. tuple. +

''', + '''\ +

+V seznam lahko dodajam poljubne objekte. Lahko dodamo tudi terko, poskusi: +

+
+xs = [1,2]
+xs.append((1,2))
+print (xs)
+
''' +] + +plan = [range_function, + tuples] hint = { 'final_hint': ['''\ -- cgit v1.2.1