day1/session2.tex
changeset 343 adb85e126341
parent 339 8ac5fe07810f
child 352 b44d7bcc6609
equal deleted inserted replaced
342:f91a75802238 343:adb85e126341
   477   \item Strings
   477   \item Strings
   478 \end{itemize}
   478 \end{itemize}
   479 \end{frame}
   479 \end{frame}
   480 
   480 
   481 \end{document}
   481 \end{document}
       
   482 
       
   483 %% Questions for Quiz %%
       
   484 %% ------------------ %%
       
   485 
       
   486 \begin{frame}[fragile]
       
   487 \frametitle{\incqno }
       
   488   \begin{lstlisting}
       
   489   In []: a = [1, 2, 5, 9]
       
   490   In []: a[0:-1]
       
   491   \end{lstlisting}
       
   492   What is the output?
       
   493 \end{frame}
       
   494 
       
   495 \begin{frame}
       
   496 \frametitle{\incqno }
       
   497   How do you combine two lists \emph{a} and \emph{b} to produce one list?
       
   498 \end{frame}
       
   499 
       
   500 \begin{frame}[fragile]
       
   501 \frametitle{\incqno }
       
   502   \begin{lstlisting}
       
   503   In []: a = [1, 2, 5, 9]
       
   504   \end{lstlisting}
       
   505   How do you add the value 10 to the end of this list?
       
   506 \end{frame}
       
   507 
       
   508 \begin{frame}
       
   509 \frametitle{\incqno }
       
   510 Write the code to read a file \texttt{data.txt} and print each line of it?
       
   511 \end{frame}
       
   512 
       
   513 \begin{frame}[fragile]
       
   514 \frametitle{\incqno }
       
   515 The following code snippet has an error/bug:
       
   516 \begin{lstlisting}
       
   517 In []: l = [0.1, 0.2, 0.3, 0.4]
       
   518 In []: t = [0.69, 0.90, 1.19, 1.30]
       
   519 In []: tsq = []
       
   520 In []: for time in t:
       
   521  ....:     tsq.append(time*time)
       
   522  ....:     plot(l, tsq)
       
   523 \end{lstlisting}
       
   524 What is the error? How do you fix it?
       
   525 \end{frame}