diff options
author | Madhusudan.C.S | 2009-10-28 15:53:07 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2009-10-28 15:53:07 +0530 |
commit | a02b70ed2fe60fb3e77208803c0ba22443f5d265 (patch) | |
tree | e99eb6384e424722713edcf3a0d5c883e9c43f31 /day2 | |
parent | c86ff21d630e8f3affe24c0fbca07ab22797ced1 (diff) | |
download | workshops-more-scipy-a02b70ed2fe60fb3e77208803c0ba22443f5d265.tar.gz workshops-more-scipy-a02b70ed2fe60fb3e77208803c0ba22443f5d265.tar.bz2 workshops-more-scipy-a02b70ed2fe60fb3e77208803c0ba22443f5d265.zip |
Complete session 1 day 2.
Diffstat (limited to 'day2')
-rw-r--r-- | day2/session1.tex | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/day2/session1.tex b/day2/session1.tex index 5fb42e0..721b4ce 100644 --- a/day2/session1.tex +++ b/day2/session1.tex @@ -182,6 +182,7 @@ Out[3]: True In [4]: f and t Out[4]: False \end{lstlisting} + \inctime{5} \end{frame} \subsection{Strings} @@ -252,10 +253,8 @@ In [1]: x, y = 1, 1.234 In [2]: 'x is %s, y is %s' %(x, y) Out[2]: 'x is 1, y is 1.234' \end{lstlisting} -\emphbar{ -\url{http://docs.python.org/library/stdtypes.html}\\ -} -\inctime{10} + \emphbar{\url{http://docs.python.org/library/stdtypes.html}} + \inctime{10} \end{frame} \section{Operators} @@ -338,7 +337,6 @@ Out[4]: True In [5]: pos + neg != zer Out[5]: False \end{lstlisting} -\inctime{5} \end{frame} \begin{frame}[fragile] @@ -378,19 +376,6 @@ In [6]: a = "# This is not a comment!" \inctime{15} \end{frame} -\begin{frame}[fragile] \frametitle{A question of good style} - \begin{lstlisting} - amount = 12.68 - denom = 0.05 - nCoins = round(amount/denom) - rAmount = nCoins * denom - \end{lstlisting} - \pause - \begin{block}{Style Rule \#1} - Naming is 80\% of programming - \end{block} -\end{frame} - \section{Simple IO} \begin{frame}{Simple IO} \begin{block} @@ -419,7 +404,7 @@ In [6]: a = "# This is not a comment!" \subsection{Basic Conditional flow} \begin{frame}[fragile] \frametitle{\typ{If...elif...else} example} -\begin{lstlisting} + \begin{lstlisting} x = int(raw_input("Enter an integer:")) if x < 0: print 'Be positive!' @@ -429,7 +414,8 @@ elif x == 1: print 'Single' else: print 'More' -\end{lstlisting} + \end{lstlisting} + \inctime{10} \end{frame} \subsection{Basic Looping} @@ -470,7 +456,7 @@ In []: for i in range(5): 3 9 4 16 \end{lstlisting} -\inctime{15} +\inctime{5} \end{frame} \subsection{Exercises} @@ -496,10 +482,9 @@ In []: for i in range(5): \item It appears that for all starting values there is a cycle of 4, 2, 1 at which the procedure loops. \end{enumerate} Write a program that accepts the starting value and prints out the Collatz sequence. - \end{frame} -\begin{frame}[fragile]{Problem 1.4} +\begin{frame}[fragile]{Problem 1.3} Write a program that prints the following pyramid on the screen. \begin{lstlisting} 1 @@ -510,7 +495,17 @@ In []: for i in range(5): The number of lines must be obtained from the user as input.\\ \pause \emphbar{When can your code fail?} -\only<2->{\inctime{20}} +\only<2->{\inctime{10}} +\end{frame} + +\begin{frame}[fragile] + \frametitle{What did we learn?} + \begin{itemize} + \item Basic data types + \item Arithematic, logical and relational operations + \item Conditional structures + \item Loops + \end{itemize} \end{frame} \end{document} |