day1/Session-3.tex
changeset 47 21de307e6823
parent 42 3e554af428a4
child 48 7f4c51382f89
equal deleted inserted replaced
43:ef2afc5ceb3f 47:21de307e6823
    76 \title[Basic Python]{Python:\\A great programming toolkit}
    76 \title[Basic Python]{Python:\\A great programming toolkit}
    77 
    77 
    78 \author[Asokan \& Prabhu] {Asokan Pichai\\Prabhu Ramachandran}
    78 \author[Asokan \& Prabhu] {Asokan Pichai\\Prabhu Ramachandran}
    79 
    79 
    80 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    80 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    81 \date[] {10, October 2009}
    81 \date[] {Day 1, Session-3, 10, October 2009}
    82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    83 
    83 
    84 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
    84 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
    85 %\logo{\pgfuseimage{iitmlogo}}
    85 %\logo{\pgfuseimage{iitmlogo}}
    86 
    86 
   109 \begin{frame}
   109 \begin{frame}
   110   \titlepage
   110   \titlepage
   111 \end{frame}
   111 \end{frame}
   112 
   112 
   113 \section{Python}
   113 \section{Python}
       
   114 
       
   115 \subsection{Problem Set based on Lists and Tuples}
   114 
   116 
   115 \begin{frame}
   117 \begin{frame}
   116   {Problem set 3}
   118   {Problem set 3}
   117   As you can guess, idea is to use \kwrd{for}!
   119   As you can guess, idea is to use \kwrd{for}!
   118 \end{frame}
   120 \end{frame}
   222 \begin{frame}{Problem 4.3}
   224 \begin{frame}{Problem 4.3}
   223     For the same data file compute the average marks in different
   225     For the same data file compute the average marks in different
   224     subjects, the student with the maximum mark in each subject and also
   226     subjects, the student with the maximum mark in each subject and also
   225     the standard deviation of the marks.  Do this efficiently.
   227     the standard deviation of the marks.  Do this efficiently.
   226 
   228 
   227     \inctime{20}
   229     \inctime{30}
   228 \end{frame}
   230 \end{frame}
   229 
   231 
   230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   231 % TIME: 20 m, running 205m 
   233 % TIME: 30 m, running 215m 
   232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   233 
   235 
   234 \subsection{Modules}
   236 \subsection{Modules}
   235 
   237 
   236 \begin{frame}[fragile]
   238 \begin{frame}[fragile]
   333 
   335 
   334 \begin{frame}[fragile]
   336 \begin{frame}[fragile]
   335   \frametitle{Problem 5.1}
   337   \frametitle{Problem 5.1}
   336 
   338 
   337   Put all the functions you have written so far as part of the problems
   339   Put all the functions you have written so far as part of the problems
   338   into one module called \typ{iitb.py} and use this module from IPython.
   340   into one module called \typ{bprim.py} and use this module from IPython.
   339 
   341 
   340 \inctime{20}
   342 \inctime{25}
   341 \end{frame}
   343 \end{frame}
   342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   343 % TIME: 20 m, running 225m 
   345 % TIME: 25 m, running 230m 
   344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   347 
       
   348 \subsection{Coding Style in Python}
       
   349 \begin{frame}{Readability and Consistency}
       
   350     \begin{itemize}
       
   351         \item Readability Counts!-Code is read more often than its written.
       
   352         \item Consistency!
       
   353         \item Know when to be inconsistent.
       
   354       \end{itemize}
       
   355 \end{frame}
       
   356 
       
   357 \begin{frame}[fragile]
       
   358   \frametitle{Code Layout}
       
   359   \begin{itemize}
       
   360         \item Indentation
       
   361         \item Tabs or Spaces??
       
   362         \item Maximum Line Length
       
   363         \item Blank Lines
       
   364         \item Encodings
       
   365    \end{itemize}
       
   366 \end{frame}
       
   367 
       
   368 \begin{frame}{Whitespaces in Expressions}
       
   369   \begin{itemize}
       
   370         \item When to use extraneous whitespaces??
       
   371         \item When to avoid extra whitespaces??
       
   372         \item Use one statement per line
       
   373    \end{itemize}
       
   374 \end{frame}
       
   375 
       
   376 \begin{frame}{Comments}
       
   377   \begin{itemize}
       
   378         \item No comments better than contradicting comments
       
   379         \item Block comments
       
   380         \item Inline comments
       
   381    \end{itemize}
       
   382 \end{frame}
       
   383 
       
   384 \begin{frame}{Docstrings}
       
   385   \begin{itemize}
       
   386         \item When to write docstrings?
       
   387         \item Ending the docstrings
       
   388         \item One liner docstrings
       
   389    \end{itemize}
       
   390 \inctime{10}
       
   391 \end{frame}
       
   392 
   345 
   393 
   346 \subsection{Objects}
   394 \subsection{Objects}
   347 \begin{frame}{Objects in Python}
   395 \begin{frame}{Objects in Python}
   348     \begin{itemize}
   396     \begin{itemize}
   349         \item What is an Object? (Types and classes)
   397         \item What is an Object? (Types and classes)
   374   All objects providing a similar inteface can be used the same way.\\
   422   All objects providing a similar inteface can be used the same way.\\
   375   Functions (and others) are first-class objects. Can be passed to and returned from functions.
   423   Functions (and others) are first-class objects. Can be passed to and returned from functions.
   376   \inctime{10}
   424   \inctime{10}
   377 \end{frame}
   425 \end{frame}
   378 
   426 
   379 \subsection{Coding Style in Python}
       
   380 \begin{frame}{Readability and Consistency}
       
   381     \begin{itemize}
       
   382         \item Readability Counts!-Code is read more often than its written.
       
   383         \item Consistency!
       
   384         \item Know when to be inconsistent.
       
   385       \end{itemize}
       
   386 \end{frame}
       
   387 
       
   388 \begin{frame}[fragile]
       
   389   \frametitle{Code Layout}
       
   390   \begin{itemize}
       
   391         \item Indentation
       
   392         \item Tabs or Spaces??
       
   393         \item Maximum Line Length
       
   394         \item Blank Lines
       
   395         \item Encodings
       
   396    \end{itemize}
       
   397 \end{frame}
       
   398 
       
   399 \begin{frame}{Whitespaces in Expressions}
       
   400   \begin{itemize}
       
   401         \item When to use extraneous whitespaces??
       
   402         \item When to avoid extra whitespaces??
       
   403         \item Use one statement per line
       
   404    \end{itemize}
       
   405 \end{frame}
       
   406 
       
   407 \begin{frame}{Comments}
       
   408   \begin{itemize}
       
   409         \item No comments better than contradicting comments
       
   410         \item Block comments
       
   411         \item Inline comments
       
   412    \end{itemize}
       
   413 \end{frame}
       
   414 
       
   415 \begin{frame}{Docstrings}
       
   416   \begin{itemize}
       
   417         \item When to write docstrings?
       
   418         \item Ending the docstrings
       
   419         \item One liner docstrings
       
   420    \end{itemize}
       
   421 \end{frame}
       
   422 \inctime{10}
       
   423 \end{document}
   427 \end{document}