day1/session3.tex
changeset 343 adb85e126341
parent 339 8ac5fe07810f
child 358 162e3e453920
equal deleted inserted replaced
342:f91a75802238 343:adb85e126341
   451    \item Functions for statistical computations - mean, median, standard deviation
   451    \item Functions for statistical computations - mean, median, standard deviation
   452   \end{itemize}
   452   \end{itemize}
   453 \end{frame}
   453 \end{frame}
   454 
   454 
   455 \end{document}
   455 \end{document}
       
   456 
       
   457 %% Questions for Quiz %%
       
   458 %% ------------------ %%
       
   459 
       
   460 \begin{frame}
       
   461 \frametitle{\incqno }
       
   462   A sample line from a Comma Separated Values (CSV) file:\\
       
   463   \vspace*{0.2in}
       
   464   \emph{Rossum, Guido, 42, 56, 34, 54}\\
       
   465   \vspace*{0.2in}
       
   466   What code would you use to separate the line into fields?
       
   467 \end{frame}
       
   468 
       
   469 \begin{frame}[fragile]
       
   470 \frametitle{\incqno }
       
   471   \begin{lstlisting}
       
   472   In []: a = [1, 2, 5, 9]
       
   473   \end{lstlisting}
       
   474   How do you find the length of this list?
       
   475 \end{frame}
       
   476 
       
   477 \begin{frame}[fragile]
       
   478 \frametitle{\incqno }
       
   479   \begin{lstlisting}
       
   480   In [1]: d = {
       
   481           'a': 1,
       
   482           'b': 2
       
   483           }
       
   484   In [2]: print d['c']
       
   485   \end{lstlisting}
       
   486   What is the output?
       
   487 \end{frame}
       
   488 
       
   489 \begin{frame}[fragile]
       
   490 \frametitle{\incqno }
       
   491 \begin{lstlisting}
       
   492 In []: sc = {'A': 10, 'B': 20, 
       
   493              'C': 70}
       
   494 \end{lstlisting}
       
   495 Given the above dictionary, what command will you give to plot a
       
   496 pie-chart?
       
   497 \end{frame}
       
   498 
       
   499 \begin{frame}[fragile]
       
   500 \frametitle{\incqno }
       
   501 \begin{lstlisting}
       
   502 In []: marks = [10, 20, 30, 50, 55, 
       
   503                 75, 83] 
       
   504 \end{lstlisting}
       
   505 Given the above marks, how will you calculate the \alert{mean} and
       
   506 \alert{standard deviation}?
       
   507 \end{frame}
       
   508 
       
   509 \begin{frame}[fragile]
       
   510 \frametitle{\incqno }
       
   511 \begin{lstlisting}
       
   512 In []: marks = [10, 20, 30, 50, 55, 
       
   513                75, 83] 
       
   514 \end{lstlisting}
       
   515 How will you convert the list \texttt{marks} to an \alert{array}?
       
   516 \end{frame}
       
   517 
       
   518 %% \begin{frame}[fragile]
       
   519 %% \frametitle{\incqno }
       
   520 %%   \begin{lstlisting}
       
   521 %%   for x in "abcd":
       
   522 %%       print x
       
   523 
       
   524 %%   a
       
   525 %%   b
       
   526 %%   c
       
   527 %%   d
       
   528 %%   \end{lstlisting}
       
   529 %%   How do you get the following output? 
       
   530 %%   \begin{lstlisting}
       
   531 %%     0 a
       
   532 %%     1 b
       
   533 %%     2 c
       
   534 %%     3 d
       
   535 %%   \end{lstlisting}
       
   536 %% \end{frame}
       
   537