Commit 1f703651 authored by Martin Mareš's avatar Martin Mareš
Browse files

Comprehensions: Hezčí řešení příkladu s řazením slov podle délky

parent bcf1ec14
......@@ -19,5 +19,4 @@ def nasobeni_matic(x, y):
def slova_podle_delky(radek):
dvojice = [ (len(slovo), slovo) for slovo in radek.split() ]
for _, slovo in sorted(dvojice):
return [ slovo for _, slovo in sorted(dvojice) ]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment