From 5db9e65c81bdf81ed4030040ff3666362e860d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= Date: Thu, 29 Oct 2015 16:08:34 +0100 Subject: Bugfix. Added some hints. --- .../functions_and_modules/longest_word/sl.py | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'python/problems/functions_and_modules') diff --git a/python/problems/functions_and_modules/longest_word/sl.py b/python/problems/functions_and_modules/longest_word/sl.py index eb85509..0d4b057 100644 --- a/python/problems/functions_and_modules/longest_word/sl.py +++ b/python/problems/functions_and_modules/longest_word/sl.py @@ -16,11 +16,35 @@ Napiši funkcijo longest(s), ki vrne najdaljšo besedo v nizu ''' -plan = ['''\ -

-''', +split = ['''\ +

+Uporabi metodo split, ki razdeli niz na podnize.

''', + '''\ +
+>>> st = 'an ban pet podgan'
+>>> st.split()
+['an', 'ban', 'pet, 'podgan']
+
+'''] + +len_func = [ '''\ -

'''] +

Funkcija len vrne dolžino niza (pa tudi seznama, terke, itd.)

'''] + + + + +plan = [split, +'''\ +
+def longest(s):
+    z zanko čez vse besede
+        če je beseda daljša od trenutno najdaljše besede
+            ustrezno spremeni najdaljšo besedo
+    vrni rezultat
+
+''', + len_func] hint = { 'final_hint': ['''\ -- cgit v1.2.1