diff -r ef2afc5ceb3f -r 21de307e6823 day1/Session-3.tex --- a/day1/Session-3.tex Tue Oct 06 18:45:01 2009 +0530 +++ b/day1/Session-3.tex Wed Oct 07 00:49:14 2009 +0530 @@ -78,7 +78,7 @@ \author[Asokan \& Prabhu] {Asokan Pichai\\Prabhu Ramachandran} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {10, October 2009} +\date[] {Day 1, Session-3, 10, October 2009} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -112,6 +112,8 @@ \section{Python} +\subsection{Problem Set based on Lists and Tuples} + \begin{frame} {Problem set 3} As you can guess, idea is to use \kwrd{for}! @@ -224,11 +226,11 @@ subjects, the student with the maximum mark in each subject and also the standard deviation of the marks. Do this efficiently. - \inctime{20} + \inctime{30} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% TIME: 20 m, running 205m +% TIME: 30 m, running 215m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Modules} @@ -335,47 +337,14 @@ \frametitle{Problem 5.1} Put all the functions you have written so far as part of the problems - into one module called \typ{iitb.py} and use this module from IPython. + into one module called \typ{bprim.py} and use this module from IPython. -\inctime{20} +\inctime{25} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% TIME: 20 m, running 225m +% TIME: 25 m, running 230m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\subsection{Objects} -\begin{frame}{Objects in Python} - \begin{itemize} - \item What is an Object? (Types and classes) - \item identity - \item type - \item method - \end{itemize} -\end{frame} - -\begin{frame}[fragile] - \frametitle{Why are they useful?} - \small - \begin{lstlisting} -for element in (1, 2, 3): - print element -for key in {'one':1, 'two':2}: - print key -for char in "123": - print char -for line in open("myfile.txt"): - print line -for line in urllib2.urlopen('http://site.com'): - print line - \end{lstlisting} -\end{frame} - -\begin{frame}{And the winner is \ldots OBJECTS!} - All objects providing a similar inteface can be used the same way.\\ - Functions (and others) are first-class objects. Can be passed to and returned from functions. - \inctime{10} -\end{frame} - \subsection{Coding Style in Python} \begin{frame}{Readability and Consistency} \begin{itemize} @@ -418,6 +387,41 @@ \item Ending the docstrings \item One liner docstrings \end{itemize} +\inctime{10} \end{frame} -\inctime{10} + + +\subsection{Objects} +\begin{frame}{Objects in Python} + \begin{itemize} + \item What is an Object? (Types and classes) + \item identity + \item type + \item method + \end{itemize} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Why are they useful?} + \small + \begin{lstlisting} +for element in (1, 2, 3): + print element +for key in {'one':1, 'two':2}: + print key +for char in "123": + print char +for line in open("myfile.txt"): + print line +for line in urllib2.urlopen('http://site.com'): + print line + \end{lstlisting} +\end{frame} + +\begin{frame}{And the winner is \ldots OBJECTS!} + All objects providing a similar inteface can be used the same way.\\ + Functions (and others) are first-class objects. Can be passed to and returned from functions. + \inctime{10} +\end{frame} + \end{document}