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]]}
67 \begin{block
}{operators
}
69 \item Numbers:
\mintinline{python
}{+ - / * //
% @ **}
70 \item Comparison:
\mintinline{python
}{< <= > >= == != is
}
71 \item Boolean:
\mintinline{python
}{and or not
}
72 \item Bitwise:
\mintinline{python
}{& | ^ ~ << >>
}
73 \item List:
\mintinline{python
}{[i
] [i:j
] in
}
74 \item In place:
\mintinline{python
}{*= += ...
}
79 \section{Control flow
}
80 \subsection{If, then, else
}
81 \begin{frame
}[fragile
]
82 \frametitle{Conditional execution
}
83 \framesubtitle{\texttt{fizzbuzz.py
}}
84 \begin{minted
}{python
}
85 #!/usr/bin/env python3
87 i = int(input('Enter a number: '))
88 if i
% 3 == 0 and i % 5 == 0:
99 \begin{frame
}[fragile
]
100 \frametitle{Conditional execution
2}
101 \framesubtitle{\texttt{fizzbuzz.py
}}
102 \begin{minted
}{shell-session
}
103 frobnicator@frobmachine~$ python fizzbuzz.py
106 frobnicator@frobmachine~$ python fizzbuzz.py
109 frobnicator@frobmachine~$ python fizzbuzz.py
112 frobnicator@frobmachine~$ python fizzbuzz.py
118 \subsection{While, for
}
119 \begin{frame
}[fragile
]
121 \begin{minted
}{python
}
122 ls =
["hello", "world", "!"
]
129 for i in range(
0, len(ls)):
140 \begin{frame
}[fragile
]
141 \frametitle{Looping: Escape rope
}
142 \begin{minted
}{python
}
143 #
100.000st prime,
100.001st prime, and a pseudoprime
144 numbers =
[1299709,
1299721,
1299709*
1299721]
146 for x in range(
2, n):
148 print(n, 'equals', x, '*', n//x)
151 print(n, 'is a prime number')
153 #
1299709 is a prime number
154 #
1299721 is a prime number
155 #
1689259081189 equals
1299709 *
1299721
161 \subsection{Functions
}
162 \begin{frame
}[fragile
]
163 \frametitle{Functions
}
167 \begin{frame
}[fragile
]
168 \frametitle{Functions: Advanced arguments
}
172 \section{Datastructures
}
174 \section{Input/Output
}
178 \section{Standard Library
}