7 \frametitle{What is Python
}
8 \includegraphics[width=
\linewidth]{2.png
}
12 \frametitle{What is Python
}
22 \begin{frame
}[fragile
]
23 \frametitle{How to start
}
24 \framesubtitle{Interpreter
}
25 \begin{minted
}[breaklines=true
]{pycon
}
26 Python
3.5.1 (default, Dec
7 2015,
12:
58:
09)
28 Type "help", "copyright", "credits" or "license" for more
30 >>> print('Hello world!')
33 >>> print(str(i/
46) + ' hoi')
34 42.869565217391305 hoi
38 \begin{frame
}[fragile
]
39 \frametitle{How to start
}
40 \framesubtitle{Source files
}
41 \begin{minted
}{python
}
42 #!/usr/bin/env python3
43 # -*- coding: utf-
8 -*-
47 print(str(i/
46) + ' hoi')
52 \begin{frame
}[fragile
]
53 \frametitle{Basictypes
}
56 \mintinline{python
}{bool
} &
\mintinline{python
}{True, False
}\\
57 \mintinline{python
}{int
} &
\mintinline{python
}{1, -
4,
999}\\
58 \mintinline{python
}{complex
} &
\mintinline{python
}{4j+
1, j
}\\
59 \mintinline{python
}{float
} &
\mintinline{python
}
60 {1.0,
4.5,
5e9, float('NaN'), float('inf')
}\\
61 \mintinline{python
}{str
} &
\mintinline{python
}
62 {'hi', "hi", '"', "'", """hi"""
}\\
63 \mintinline{python
}{list
} &
\mintinline{python
}
64 {[], ...,
[1,
2,
3],
['a',
42],
[[],
[1]]}\\
65 \mintinline{python
}{tuple
} &
\mintinline{python
}
66 {(
1,), (
1,
2), (
1, 'a', True), ((
4,
3),
4)
}
69 \begin{block
}{operators
}
71 \item Numbers:
\mintinline{python
}{+ - / * //
% @ **}
72 \item Comparison:
\mintinline{python
}{< <= > >= == != is
}
73 \item Boolean:
\mintinline{python
}{and or not
}
74 \item Bitwise:
\mintinline{python
}{& | ^ ~ << >>
}
75 \item List:
\mintinline{python
}{[i
] [i:j
] in
}
76 \item In place:
\mintinline{python
}{*= += ...
}
81 \section{Control flow
}
82 \subsection{If, then, else
}
83 \begin{frame
}[fragile
]
84 \frametitle{Conditional execution
}
85 \framesubtitle{\texttt{fizzbuzz.py
}}
86 \begin{minted
}{python
}
87 #!/usr/bin/env python3
89 i = int(input('Enter a number: '))
90 if i
% 3 == 0 and i % 5 == 0:
101 \begin{frame
}[fragile
]
102 \frametitle{Conditional execution
2}
103 \framesubtitle{\texttt{fizzbuzz.py
}}
104 \begin{minted
}{shell-session
}
105 frobnicator@frobmachine~$ python fizzbuzz.py
108 frobnicator@frobmachine~$ python fizzbuzz.py
111 frobnicator@frobmachine~$ python fizzbuzz.py
114 frobnicator@frobmachine~$ python fizzbuzz.py
120 \subsection{While, for
}
121 \begin{frame
}[fragile
]
123 \begin{minted
}{python
}
124 ls =
["hello", "world", "!"
]
131 for i in range(
0, len(ls)):
142 \begin{frame
}[fragile
]
143 \frametitle{Looping: Escape rope
}
144 \begin{minted
}{python
}
145 #
100.000st prime,
100.001st prime, and a pseudoprime
146 numbers =
[1299709,
1299721,
1299709*
1299721]
148 for x in range(
2, n):
150 print(n, 'equals', x, '*', n//x)
153 print(n, 'is a prime number')
155 #
1299709 is a prime number
156 #
1299721 is a prime number
157 #
1689259081189 equals
1299709 *
1299721
163 \subsection{Functions
}
164 \begin{frame
}[fragile
]
165 \frametitle{Functions
}
169 \begin{frame
}[fragile
]
170 \frametitle{Functions: Advanced arguments
}
174 \section{Datastructures
}
176 \section{Input/Output
}
180 \section{Standard Library
}