Commit f21d38e6 authored by Mareš Martin's avatar Mareš Martin
Browse files

07: Příklad na zip

parent 03199434
......@@ -75,6 +75,29 @@ b \cmt{(přiřazení každého prvku n-tice/seznamu zvlášť)}
% ----------------------------------------------------------------------
\begin{frame}{Příklad: Zipování seznamů}
\py{%
x = [1, 2, 3]\\
y = ["a", "b", "c"]\\
list(zip(x, y))
}{%
[(1, 'a'), (2, 'b'), (3, 'c')]
}
\py{%
for i, j in zip(x, y):\\
\>print(i, j)
}{%
1 a\\
2 b\\
3 c
}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}{List comprehension}
\py{%
......
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