From 5db9e65c81bdf81ed4030040ff3666362e860d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= <martin.mozina@fri.uni-lj.si> 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/longest_word') 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 <code>longest(s)</code>, ki vrne najdaljšo besedo v nizu <code 'podgan' </p>''' -plan = ['''\ -<p></p> -''', +split = ['''\ +<p> +Uporabi metodo <code>split</code>, ki razdeli niz na podnize.</p>''', + '''\ +<pre> +>>> st = 'an ban pet podgan' +>>> st.split() +['an', 'ban', 'pet, 'podgan'] +</pre> +'''] + +len_func = [ '''\ -<p></p>'''] +<p>Funkcija <code>len</code> vrne dolžino niza (pa tudi seznama, terke, itd.)</p>'''] + + + + +plan = [split, +'''\ +<pre> +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 +</pre> +''', + len_func] hint = { 'final_hint': ['''\ -- cgit v1.2.1