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{Built-in types
}
55 \mintinline{python
}{bool
} &
\mintinline{python
}{True, False
}\\
56 \mintinline{python
}{int
} &
\mintinline{python
}{1, -
4,
999}\\
57 \mintinline{python
}{complex
} &
\mintinline{python
}{4j+
1, j
}\\
58 \mintinline{python
}{float
} &
\mintinline{python
}
59 {1.0,
4.5,
5e9, float('NaN'), float('inf')
}\\
60 \mintinline{python
}{str
} &
\mintinline{python
}
61 {'hi', "hi", '"', "'", """hi""", "
\n\"
\t", '\"'
}\\
62 \mintinline{python
}{list
} &
\mintinline{python
}
63 {[], ...,
[1,
2,
3],
['a',
42],
[[],
[1]]}\\
64 \mintinline{python
}{tuple
} &
\mintinline{python
}
65 {(
1,), (
1,
2), (
1, 'a', True), ((
4,
3),
4)
}\\
66 \mintinline{python
}{dict
} &
\mintinline{python
}
67 {{1: 'a',
2: 'b'
},
{"hi":
42, "test":
{}},
{}}\\
68 \mintinline{python
}{set
} &
\mintinline{python
}
69 {{1,
2},
{"hi", "a"
}, set()
}\\
70 Others &
\mintinline{python
}
71 {range, bytes, bytearray, memoryview, frozenset
}\\
72 Special &
\mintinline{python
}
73 {type, None, ..., NotImplemented
}\\
77 \begin{frame
}[fragile
]
78 \frametitle{Basictypes: Operators
}
79 \begin{block
}{operators
}
81 \item Numbers:
\mintinline{python
}{+ - / * //
% @ **}
82 \item Comparison:
\mintinline{python
}{< <= > >= == !=
}
83 \item Boolean:
\mintinline{python
}{and or not
}
84 \item Bitwise:
\mintinline{python
}{& | ^ ~ << >>
}
85 \item List/Dictionary:
\mintinline{python
}{[i
] [i:j
] in
}
86 \item In place:
\mintinline{python
}{*= += ...
}
87 \item Special:
\mintinline{python
}{is
}
92 \section{Control flow
}
93 \subsection{If, then, else
}
94 \begin{frame
}[fragile
]
95 \frametitle{Conditional execution
}
96 \framesubtitle{\texttt{fizzbuzz.py
}}
97 \begin{minted
}{python
}
98 #!/usr/bin/env python3
100 i = int(input('Enter a number: '))
101 if i
% 3 == 0 and i % 5 == 0:
112 \begin{frame
}[fragile
]
113 \frametitle{Conditional execution
2}
114 \framesubtitle{\texttt{fizzbuzz.py
}}
115 \begin{minted
}{shell-session
}
116 frobnicator@frobmachine~$ python fizzbuzz.py
119 frobnicator@frobmachine~$ python fizzbuzz.py
122 frobnicator@frobmachine~$ python fizzbuzz.py
125 frobnicator@frobmachine~$ python fizzbuzz.py
131 \subsection{While, for
}
132 \begin{frame
}[fragile
]
134 \begin{minted
}{python
}
135 ls =
["hello", "world", "!"
]
142 for i in range(
0, len(ls)):
153 \begin{frame
}[fragile
]
154 \frametitle{Looping: Escape rope
}
155 \begin{minted
}{python
}
156 #
100.000st prime,
100.001st prime, and a pseudoprime
157 numbers =
[1299709,
1299721,
1299709*
1299721]
159 for x in range(
2, n):
161 print(n, 'equals', x, '*', n//x)
164 print(n, 'is a prime number')
166 #
1299709 is a prime number
167 #
1299721 is a prime number
168 #
1689259081189 equals
1299709 *
1299721
174 \subsection{Functions
}
175 \begin{frame
}[fragile
]
176 \frametitle{Functions
}
180 \begin{frame
}[fragile
]
181 \frametitle{Functions: Advanced arguments
}
185 \section{Datastructures
}
187 \section{Input/Output
}
191 \section{Standard Library
}