Commit a54a10a5 authored by cermak's avatar cermak
Browse files

Lesson 7 fixes and solution

parent 3fbca26d
Pipeline #19373 passed with stage
in 1 minute and 38 seconds
......@@ -58,7 +58,7 @@ teploty.get("Peklo", -999)
\begin{frame}{Cyklus přes prvky slovníku}
\py{%
for k in teploty.keys():
for k in teploty.keys(): \cmt{(případně lze keys vynechat)}
\.\>print(k)
}{%
Praha \\
......@@ -135,9 +135,9 @@ type(\{\})
}
\py{%
type(type(set()))
type(set())
}{%
<class 'dict'>
<class 'set'>
}
\end{frame}
......
def nasobilka(n):
return [[i*j for i in range(1, n+1)] for j in range(1, n+1)]
def prunik_seznamu(x, y):
return [a for a in x if a in y]
def palindromy(radek):
return [slovo for slovo in radek.split() if slovo == slovo[::-1]]
def skalarni_soucin(x, y):
return sum([i*j for i, j in zip(x, y)])
def slova_podle_delky(radek):
dvojice = [ (len(slovo), slovo) for slovo in radek.split() ]
for _, slovo in sorted(dvojice):
print(slovo)
Markdown is supported
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