day2/session2.tex
changeset 344 19754ed6050f
parent 339 8ac5fe07810f
child 373 f04eca8b2f3d
equal deleted inserted replaced
343:adb85e126341 344:19754ed6050f
   534     \item Docstrings
   534     \item Docstrings
   535   \end{itemize}
   535   \end{itemize}
   536 \end{frame}
   536 \end{frame}
   537 
   537 
   538 \end{document}
   538 \end{document}
       
   539 
       
   540 %% Questions for Quiz %%
       
   541 %% ------------------ %%
       
   542 
       
   543 \begin{frame}
       
   544     \frametitle{\incqno}
       
   545   How do you find the presence of an element \emph{x} in the list \emph{a}?
       
   546 \end{frame}
       
   547 
       
   548 
       
   549 \begin{frame}[fragile]
       
   550     \frametitle{\incqno}
       
   551   \begin{lstlisting}
       
   552 In []: set([1, 2, 8, 2, 13, 8, 9])
       
   553   \end{lstlisting}
       
   554   What is the output?
       
   555 \end{frame}
       
   556 
       
   557 \begin{frame}[fragile]
       
   558     \frametitle{\incqno}
       
   559   \begin{lstlisting}
       
   560 In []: a = {'a': 1, 'b': 2} 
       
   561 In []: a['a'] = 10
       
   562 In []: print a
       
   563   \end{lstlisting}
       
   564   What is the output?
       
   565 \end{frame}
       
   566 
       
   567 \begin{frame}[fragile]
       
   568     \frametitle{\incqno}
       
   569   \begin{lstlisting}
       
   570 In []: for i in range(3, 10, 2):
       
   571   ...:     print i
       
   572   \end{lstlisting}
       
   573   What is the output?
       
   574 \end{frame}
       
   575 
       
   576 \begin{frame}[fragile]
       
   577     \frametitle{\incqno}
       
   578   \begin{lstlisting}
       
   579 In []: a = [1, 2, 3] 
       
   580 In []: a.extend([5, 6])
       
   581   \end{lstlisting}
       
   582   What is the value of a?
       
   583 \end{frame}
       
   584 
       
   585 \begin{frame}[fragile]
       
   586     \frametitle{\incqno}
       
   587   \begin{lstlisting}
       
   588 In []: a = (1, 2, 3)
       
   589 In []: a[1] = 10
       
   590   \end{lstlisting}
       
   591   What is the result?
       
   592 \end{frame}
       
   593 
       
   594 \begin{frame}[fragile]
       
   595     \frametitle{\incqno}
       
   596   \begin{lstlisting}
       
   597 def func(x, y=10):
       
   598     print x+1, y+10
       
   599 
       
   600 func(1)
       
   601 
       
   602   \end{lstlisting}
       
   603   What is the output?
       
   604 \end{frame}
       
   605