Skip to content
Snippets Groups Projects
Commit f21d38e6 authored by Martin Mareš's avatar Martin Mareš
Browse files

07: Příklad na zip

parent 03199434
No related branches found
No related tags found
No related merge requests found
......@@ -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{%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment