day1/Session-4.tex
changeset 69 9fbd2a71fef2
parent 65 a525e580bc43
child 85 8ca53181bee6
equal deleted inserted replaced
68:0471f8694075 69:9fbd2a71fef2
    36     basicstyle=\ttfamily\bfseries,
    36     basicstyle=\ttfamily\bfseries,
    37     commentstyle=\color{red}\itshape,
    37     commentstyle=\color{red}\itshape,
    38   stringstyle=\color{darkgreen},
    38   stringstyle=\color{darkgreen},
    39   showstringspaces=false,
    39   showstringspaces=false,
    40   keywordstyle=\color{blue}\bfseries}
    40   keywordstyle=\color{blue}\bfseries}
       
    41 
       
    42 \usepackage{pgf}
    41 
    43 
    42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    43 % Macros
    45 % Macros
    44 \setbeamercolor{emphbar}{bg=blue!20, fg=black}
    46 \setbeamercolor{emphbar}{bg=blue!20, fg=black}
    45 \newcommand{\emphbar}[1]
    47 \newcommand{\emphbar}[1]
   189 
   191 
   190 
   192 
   191 \begin{frame}
   193 \begin{frame}
   192   \frametitle{Problem set 6.2}
   194   \frametitle{Problem set 6.2}
   193   \begin{description}
   195   \begin{description}
   194     \item[2.2.1] Given a dictionary of the names of students and their marks, identify how many duplicate marks are there? and what are these?
   196     \item[6.2.1] Given a dictionary of the names of students and their marks, identify how many duplicate marks are there? and what are these?
   195     \item[2.2.2] Given a string of the form ``4-7, 9, 12, 15'' find the numbers missing in this list for a given range.
   197     \item[6.2.2] Given a string of the form ``4-7, 9, 12, 15'' find the numbers missing in this list for a given range.
   196 \end{description}
   198 \end{description}
   197 \inctime{10}
   199 \inctime{10}
   198 \end{frame}
   200 \end{frame}
   199 
   201 
   200 \subsection{Functions Reloaded!}
   202 \subsection{Functions Reloaded!}
   337 \end{frame}
   339 \end{frame}
   338 
   340 
   339 \begin{frame}[fragile]
   341 \begin{frame}[fragile]
   340     \frametitle{Debugging effectively}
   342     \frametitle{Debugging effectively}
   341     \begin{itemize}
   343     \begin{itemize}
   342         \item  \kwrd{print} based strategy
   344         \item \kwrd{print} based strategy
   343         \item Process: Hypothesis, test, refine, rinse-repeat
   345         \item Process:
   344     \end{itemize}
   346     \end{itemize}
   345 \inctime{15}
   347 \pgfimage[interpolate=true,width=5cm,height=5cm]{DebugginDiagram.png}
   346 \end{frame}
   348 \end{frame}
   347 
   349 
   348 \begin{frame}[fragile]
   350 \begin{frame}[fragile]
   349     \frametitle{Debugging effectively}
   351     \frametitle{Debugging effectively}
   350     \begin{itemize}
   352     \begin{itemize}
   351       \item Using \typ{\%debug} and \typ{\%pdb} in IPython
   353       \item Using \typ{\%debug} and \typ{\%pdb} in IPython
   352     \end{itemize}
   354     \end{itemize}
   353 \inctime{15}
   355 \end{frame}
       
   356 
       
   357 \begin{frame}[fragile]
       
   358 \frametitle{Debugging in IPython}
       
   359 \small
       
   360 \begin{lstlisting}
       
   361 In [1]: import mymodule
       
   362 In [2]: mymodule.test()
       
   363 ---------------------------------------------
       
   364 NameError   Traceback (most recent call last)
       
   365 /media/python/iitb/workshops/day1/<ipython console> in <module>()
       
   366 /media/python/iitb/workshops/day1/mymodule.py in test()
       
   367       1 def test():
       
   368 ----> 2     print spam
       
   369 NameError: global name 'spam' is not defined
       
   370 In [3]: %debug
       
   371 > /media/python/iitb/workshops/day1/mymodule.py(2)test()
       
   372       0     print spam
       
   373 ipdb> 
       
   374 \end{lstlisting}
       
   375 \inctime{15} 
   354 \end{frame}
   376 \end{frame}
   355 
   377 
   356 \begin{frame}[fragile]
   378 \begin{frame}[fragile]
   357 \frametitle{Debugging: Exercise}
   379 \frametitle{Debugging: Exercise}
   358 \inctime{10}
   380 \inctime{10}
   364     \item Creating and using Dictionaries
   386     \item Creating and using Dictionaries
   365     \item Creating and using Sets
   387     \item Creating and using Sets
   366     \item Advances Functions: default arguments, keyword arguments
   388     \item Advances Functions: default arguments, keyword arguments
   367     \item Functional Programming, list comprehensions
   389     \item Functional Programming, list comprehensions
   368     \item Errors and Exceptions in Python
   390     \item Errors and Exceptions in Python
   369     \item Debugging: How to use pdb, \%pdb and \%debug in IPython
   391     \item Debugging: \%pdb and \%debug in IPython
   370   \end{itemize}
   392   \end{itemize}
   371 \end{frame}
   393 \end{frame}
   372 \end{document}
   394 \end{document}