day1/session2.tex
changeset 352 b44d7bcc6609
parent 343 adb85e126341
child 358 162e3e453920
child 362 26c215c5a53b
equal deleted inserted replaced
351:c9d1d5a7b629 352:b44d7bcc6609
   299 \begin{lstlisting}
   299 \begin{lstlisting}
   300 In []: tsq = []
   300 In []: tsq = []
   301 
   301 
   302 In []: for time in t:
   302 In []: for time in t:
   303  ....:     tsq.append(time*time)
   303  ....:     tsq.append(time*time)
       
   304  ....:
       
   305  ....:
   304 
   306 
   305 In []: plot(l, tsq)
   307 In []: plot(l, tsq)
   306 Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>]
   308 Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>]
   307 \end{lstlisting}
   309 \end{lstlisting}
   308 This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
   310 This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
   510 Write the code to read a file \texttt{data.txt} and print each line of it?
   512 Write the code to read a file \texttt{data.txt} and print each line of it?
   511 \end{frame}
   513 \end{frame}
   512 
   514 
   513 \begin{frame}[fragile]
   515 \begin{frame}[fragile]
   514 \frametitle{\incqno }
   516 \frametitle{\incqno }
       
   517 What would be the result of the following code snippet:
       
   518 \begin{lstlisting}
       
   519 In []: x = linspace(0, 10, 50)
       
   520 In []: y = linspace(50, 100, 100)
       
   521 In []: plot(x, y)
       
   522 \end{lstlisting}
       
   523 \end{frame}
       
   524 
       
   525 \begin{frame}[fragile]
       
   526 \frametitle{\incqno }
   515 The following code snippet has an error/bug:
   527 The following code snippet has an error/bug:
   516 \begin{lstlisting}
   528 \begin{lstlisting}
   517 In []: l = [0.1, 0.2, 0.3, 0.4]
   529 In []: l = [0.1, 0.2, 0.3, 0.4]
   518 In []: t = [0.69, 0.90, 1.19, 1.30]
   530 In []: t = [0.69, 0.90, 1.19, 1.30]
   519 In []: tsq = []
   531 In []: tsq = []