From 917c03b29ff321ad625cc652b543b94c8947142c Mon Sep 17 00:00:00 2001 From: Dimitri Merejkowsky Date: Sat, 1 Dec 2018 18:16:03 +0100 Subject: [PATCH] Stuff for 3rd section maybe --- sessions/python-03.tex | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sessions/python-03.tex diff --git a/sessions/python-03.tex b/sessions/python-03.tex new file mode 100644 index 0000000..17ee7b6 --- /dev/null +++ b/sessions/python-03.tex @@ -0,0 +1,29 @@ + +\begin{frame}[fragile] + \frametitle{Slicer des strings} + +\begin{lstlisting} +>>> message = "Bonjour, monde !" +>>> message[0] # ça commence à zéro +"B" +>>> message[15] +"!" +>>>> message[-1] # compter à l'envers +"!" +\end{lstlisting} +\end{frame} + + +\begin{frame}[fragile] + \frametitle{Slicer des strings (2)} + +\begin{lstlisting} +>>> message = "Bonjour, monde !" +>>> message[1:4] # début, fin +'onj' +>>> message[:7] # début implicite +'Bonjour' +>>> message[9:-2] # fin négative +'monde' +\end{lstlisting} +\end{frame}