diff options
author | Martin Možina <martin.mozina@fri.uni-lj.si> | 2015-10-26 17:50:22 +0100 |
---|---|---|
committer | Martin Možina <martin.mozina@fri.uni-lj.si> | 2015-10-26 17:50:22 +0100 |
commit | ed5473c15bdb472219056b30850605cf7e3b9a18 (patch) | |
tree | 4df880722b9865a2c5ef5bc23032e77144e5a763 /python/problems/functions/assign_numbers | |
parent | ce6b6b0bc9af3cff176bd995ee25c8334eea632c (diff) |
Corrected tests in for-loop problems.
Fixed some typos.
Diffstat (limited to 'python/problems/functions/assign_numbers')
-rw-r--r-- | python/problems/functions/assign_numbers/sl.py | 36 |
1 files changed, 31 insertions, 5 deletions
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 = '''\ <p> -Napišite funkcijo <code>numbers(xs)</code>, ki vrne seznam oblike <code>[(0, xs[0]), (1, xs[1]), ..., (n, xs[n])]</code>. +Napiši 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]) @@ -20,11 +20,37 @@ Napišite funkcijo <code>numbers(xs)</code>, ki vrne seznam oblike <code>[(0, xs </pre> </p>''' -plan = ['''\ -<p></p> -''', +range_function = [ '''\ -<p></p>'''] +<p> +Uporabi funkcijo <code>range</code>. +</p>''', + '''\ +<p>Poskusi, kaj naredi naslednji program: </p> +<pre> +xs = [2,3,4,5] +for i in range(len(xs)): + print (i, xs[i]) +</pre>'''] + +tuples = [ + '''\ +<p> +Več elementov skupaj v navadnih oklepajih imenujemo terka oz. <code>tuple</code>. +</p>''', + '''\ +<p> +V seznam lahko dodajam poljubne objekte. Lahko dodamo tudi terko, poskusi: +</p> +<pre> +xs = [1,2] +xs.append((1,2)) +print (xs) +</pre>''' +] + +plan = [range_function, + tuples] hint = { 'final_hint': ['''\ |