cce175010548c6ec782bff71f16461dec36cc7c9
[linuxnijmegen-python.git] / p.tex
1 %&p
2 \begin{document}
3 \frame{\titlepage}
4
5 \section{Introduction}
6 \begin{frame}
7 \frametitle{What is Python}
8 \includegraphics[width=\linewidth]{2.png}
9 \end{frame}
10
11 \begin{frame}
12 \frametitle{What is Python}
13 \begin{itemize}
14 \item Interpreted
15 \item Duck-typing
16 \item High-level
17 \item Multi-paradigm
18 \item \ldots
19 \end{itemize}
20 \end{frame}
21
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)
27 [GCC 5.2.0] on linux
28 Type "help", "copyright", "credits" or "license" for more
29 information.
30 >>> print('Hello world!')
31 Hello world!
32 >>> i = 1972
33 >>> print(str(i/46) + ' hoi')
34 42.869565217391305 hoi
35 \end{minted}
36 \end{frame}
37
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 -*-
44
45 print('hello world')
46 i = 1972
47 print(str(i/46) + ' hoi')
48 \end{minted}
49 \end{frame}
50
51 \section{Basics}
52 \begin{frame}[fragile]
53 \frametitle{Basictypes}
54 \begin{block}{types}
55 \begin{tabular}{ll}
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 \end{tabular}
66 \end{block}
67 \begin{block}{operators}
68 \begin{itemize}
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}{*= += ...}
75 \end{itemize}
76 \end{block}
77 \end{frame}
78
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
86
87 i = int(input('Enter a number: '))
88 if i % 3 == 0 and i % 5 == 0:
89 print('fizzbuzz')
90 elif i % 3 == 0:
91 print('buzz')
92 elif i % 5 == 0:
93 print('fizz')
94 else:
95 print(i)
96 \end{minted}
97 \end{frame}
98
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
104 Enter a number: 42
105 buzz
106 frobnicator@frobmachine~$ python fizzbuzz.py
107 Enter a number: 15
108 fizzbuzz
109 frobnicator@frobmachine~$ python fizzbuzz.py
110 Enter a number: 43
111 43
112 frobnicator@frobmachine~$ python fizzbuzz.py
113 Enter a number: 9
114 fizz
115 \end{minted}
116 \end{frame}
117
118 \subsection{While, for}
119
120 \subsection{Functions}
121
122 \section{Datastructures}
123
124 \section{Input/Output}
125
126 \section{Errors}
127
128 \section{Standard Library}
129 \end{document}