From e0a5dd801c8382848b28503a81c141d0d15f5833 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 23 Sep 2015 10:19:19 +0200 Subject: Minor changes to greatest problems. Mostly text corrections. --- python/problems/functions/greatest/sl.py | 36 +++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'python/problems/functions/greatest/sl.py') diff --git a/python/problems/functions/greatest/sl.py b/python/problems/functions/greatest/sl.py index 0321d23..d018503 100644 --- a/python/problems/functions/greatest/sl.py +++ b/python/problems/functions/greatest/sl.py @@ -9,21 +9,21 @@ slug = 'Največji' description = '''\ -

Napišite funkcijo naj(xs), ki vrne največje število v seznamu xs. +

Napišite funkcijo max_val(xs), ki vrne največje število v seznamu xs.

->>> naj([5, 1, -6, -7, 2])
+>>> max_val([5, 1, -6, -7, 2])
 5
 

''' function = ['''\ -

Napišite definicijo funckcije naj(xs)

''', +

Napišite definicijo funckcije max_val(xs)

''', '''\

Definicijo funkcije začnemo z def, temu sledi ime, potem oklepaji, v katerih naštejemo argumente funkcije, nato zaklepaj in na koncu dvopičje

''', '''\
-def naj(xs):
+def max_val(xs):
     # program, ki poišče največjega v xs
 
'''] @@ -64,14 +64,14 @@ xs = [5, 1, -6, -7, 2] '''\
 # najprej definicija funkcije
-def naj...
+def max_val...
 
 s1 = [5, 1, -6, -7, 2]
-naj_elt = naj(s1)
+naj_elt = max_val(s1)
 print(naj_elt)
 
 s2 = [-5, -1, 6, 7, -2]
-naj_elt = naj(s2)
+naj_elt = max_val(s2)
 print(naj_elt)
 
'''], function, @@ -103,5 +103,25 @@ hint = { 'for_loop': for_loop, - 'if_clause': if_clause + 'if_clause': if_clause, + + 'final_hint': '''\ +

Odlično, naloga rešena! Še zanimivost: Python ima funkcijo max že vgrajeno:

+
+def max_val(xs):
+    return max(xs)
+
''', + + 'not_int': '''\ +

Funkcija ne vrača števila

''', + + 'return_first': '''\ +

Funkcija vrača prvi element v seznamu''', + + 'return_last': '''\ +

Funkcija vrača zadnji element v seznamu.''', + + 'return_indent': '''\ +

Ali imaš stavek return znotraj zanke? +V tem primeru se lahko zgodi, da se zanka ne izteče do konca.

''' } -- cgit v1.2.1