day2/session4.tex
author Christopher Burns <chris.d.burns@gmail.com>
Tue, 29 Jun 2010 01:59:20 -0500
branchscipy2010
changeset 435 2aed1dda7909
parent 434 99e1af343b04
permissions -rw-r--r--
DOC: Add mailing lists and other links.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     2
% Tutorial slides on Python.
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     8
\documentclass[compress,14pt]{beamer}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     9
% \documentclass[handout]{beamer}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    10
% \usepackage{pgfpages}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    11
% \pgfpagesuselayout{4 on 1}[a4paper,border, shrink=5mm,landscape]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    12
\usepackage{tikz}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
\newcommand{\hyperlinkmovie}{}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    14
%\usepackage{movie15}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
% Note that in presentation mode 
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    18
% \paperwidth  364.19536pt
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
% \paperheight 273.14662pt
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
% h/w = 0.888
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
\mode<presentation>
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    24
{
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
  \usetheme{Warsaw}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
  %\usetheme{Boadilla}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
  %\usetheme{default}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 220
diff changeset
    28
  \useoutertheme{infolines}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
  \setbeamercovered{transparent}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
% To remove navigation symbols
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
\setbeamertemplate{navigation symbols}{}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
\usepackage{amsmath}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
\usepackage[english]{babel}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
\usepackage[latin1]{inputenc}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
\usepackage{times}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
\usepackage[T1]{fontenc}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
% Taken from Fernando's slides.
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
\usepackage{ae,aecompl}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    43
\usepackage{mathpazo,courier,euler}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
\usepackage[scaled=.95]{helvet}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
\usepackage{pgf}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
\definecolor{darkgreen}{rgb}{0,0.5,0}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
\usepackage{listings}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
\lstset{language=Python,
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
    basicstyle=\ttfamily\bfseries,
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
    commentstyle=\color{red}\itshape,
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
  stringstyle=\color{darkgreen},
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
  showstringspaces=false,
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
  keywordstyle=\color{blue}\bfseries}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    56
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
% My Macros
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
\setbeamercolor{postit}{bg=yellow,fg=black}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
\newcommand{\emphbar}[1]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
{\begin{beamercolorbox}[rounded=true]{emphbar} 
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    63
      {#1}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    64
 \end{beamercolorbox}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    65
}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    66
%{\centerline{\fcolorbox{gray!50} {blue!10}{
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    67
%\begin{minipage}{0.9\linewidth}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    68
%    {#1} 
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    69
%\end{minipage}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    70
%    }}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    71
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
\newcommand{\myemph}[1]{\structure{\emph{#1}}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
\newcommand{\PythonCode}[1]{\lstinline{#1}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
\newcommand{\tvtk}{\texttt{tvtk}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    76
\newcommand{\mlab}{\texttt{mlab}}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
    77
\newcommand{\typ}[1]{\lstinline{#1}}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    78
\newcounter{time}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    79
\setcounter{time}{0}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    80
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\vspace*{0.1in}\tiny \thetime\ m}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    81
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    82
\newcommand\BackgroundPicture[1]{%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    83
  \setbeamertemplate{background}{%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    84
      \parbox[c][\paperheight]{\paperwidth}{%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    85
      \vfill \hfill
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
 \hfill \vfill
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    87
}}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    88
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    90
% Configuring the theme
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    91
%\setbeamercolor{normal text}{fg=white}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    92
%\setbeamercolor{background canvas}{bg=black}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    93
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    94
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    95
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    97
% Title page
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
    98
\title[Python Development]{Python Development}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    99
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   100
\author[FOSSEE] {FOSSEE}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   101
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   102
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
389
aa392117454f Changed dates for MVIT workshop.
Puneeth Chaganti <punchagan@gmail.com>
parents: 385
diff changeset
   103
\date[] {1 May, 2010\\Day 2, Session 4}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   104
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   105
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   106
%\pgfdeclareimage[height=0.75cm]{iitblogo}{iitblogo}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   107
%\logo{\pgfuseimage{iitblogo}}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   108
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   109
\AtBeginSection[]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   110
{
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   111
  \begin{frame}<beamer>
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   112
    \frametitle{Outline}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   113
      \Large
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   114
    \tableofcontents[currentsection,currentsubsection]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   115
  \end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   116
}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   117
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   118
%% Delete this, if you do not want the table of contents to pop up at
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   119
%% the beginning of each subsection:
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   120
\AtBeginSubsection[]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   121
{
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   122
  \begin{frame}<beamer>
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
    \frametitle{Outline}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
    \tableofcontents[currentsection,currentsubsection]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
  \end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   126
}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   127
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   128
\AtBeginSection[]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   129
{
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   130
  \begin{frame}<beamer>
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   131
    \frametitle{Outline}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   132
    \tableofcontents[currentsection,currentsubsection]
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   133
  \end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   134
}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   135
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   136
% DOCUMENT STARTS
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   137
\begin{document}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   138
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   139
\begin{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   140
  \maketitle
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   141
\end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   142
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   143
\section{Tests: Getting started}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   144
\begin{frame}[fragile] 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   145
  \frametitle{gcd revisited!}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   146
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   147
  \item Open \texttt{gcd.py}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   148
  \end{itemize}  
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   149
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   150
    def gcd(a, b):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   151
        if a % b == 0: 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   152
            return b
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   153
        return gcd(b, a%b)
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   154
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   155
    print gcd(15, 65)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   156
    print gcd(16, 76)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   157
\end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   158
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   159
  \item \texttt{python gcd.py}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   160
  \end{itemize}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   161
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   162
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   163
\begin{frame}[fragile] 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   164
  \frametitle{Find lcm using our gcd module}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   165
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   166
  \item Open \texttt{lcm.py}  
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   167
  \item $lcm = \frac{a * b}{gcd(a,b)}$
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   168
  \end{itemize}  
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   169
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   170
    from gcd import gcd    
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   171
    def lcm(a, b):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   172
        return (a * b) / gcd(a, b)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   173
    
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   174
    print lcm(14, 56)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   175
\end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   176
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   177
  \item \texttt{python lcm.py}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   178
  \end{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   179
  \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   180
5
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   181
4
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   182
56
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   183
  \end{lstlisting}    
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   184
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   185
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   186
\begin{frame}[fragile] 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   187
  \frametitle{Writing stand-alone module}  
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   188
Edit \texttt{gcd.py} file to:
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   189
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   190
    def gcd(a, b):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   191
        if a % b == 0: 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   192
            return b
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   193
        return gcd(b, a%b)
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   194
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   195
    if __name__ == "__main__":        
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   196
        print gcd(15, 65)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   197
        print gcd(16, 76)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   198
\end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   199
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   200
  \item \texttt{python gcd.py}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   201
  \item \texttt{python lcm.py}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   202
  \end{itemize}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   203
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   204
432
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   205
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   206
\begin{frame}[fragile]
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   207
  \frametitle{Automating tests}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   208
  \begin{lstlisting}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   209
  
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   210
def gcd(a, b):
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   211
    if a % b == 0:
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   212
        return b
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   213
    return gcd(b, a % b)
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   214
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   215
if __name__ == '__main__':
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   216
    assert gcd(15, 65) == 5
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   217
    assert gcd(16, 76) == 4
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   218
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   219
  \end{lstlisting}  
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   220
\end{frame}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   221
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   222
\begin{frame}[fragile]
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   223
  \frametitle{Automating tests}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   224
  \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   225
if __name__ == '__main__':
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   226
    for line in open('numbers.txt'):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   227
        numbers = line.split()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   228
        x = int(numbers[0])
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   229
        y = int(numbers[1])
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   230
        result = int(numbers[2])
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   231
        if gcd(x, y) != result:
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   232
            print "Failed gcd test
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   233
                          for", x, y
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   234
  \end{lstlisting}  
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   235
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   236
432
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   237
\begin{frame}[fragile]
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   238
  \frametitle{Python Test Packages}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   239
    \begin{itemize}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   240
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   241
\item Python's \typ{unittest}:\linebreak
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   242
  \url{http://docs.python.org/library/unittest.html}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   243
\linebreak
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   244
\item \typ{nose}:\linebreak
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   245
  \url{http://code.google.com/p/python-nose/}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   246
  \end{itemize}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   247
\end{frame}
13e5d0e2cd40 DOC: Add more slides on testing
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   248
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   249
\section{Coding Style}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   250
\begin{frame}{Readability and Consistency}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   251
    \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   252
        \item Readability Counts!\\Code is read more often than its written.
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   253
        \item Consistency!
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   254
        \item Know when to be inconsistent.
433
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   255
        \item Play telephone with that line of code.
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   256
      \end{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   257
\end{frame}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   258
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   259
\begin{frame}[fragile] \frametitle{A question of good style}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   260
  \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   261
    amount = 12.68
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   262
    denom = 0.05
433
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   263
    num_coins = round(amount/denom)
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   264
    rounded_amount = num_coins * denom
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   265
  \end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   266
  \pause
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   267
  \begin{block}{Style Rule \#1}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   268
    Naming is 80\% of programming
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   269
  \end{block}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   270
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   271
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   272
\begin{frame}[fragile]
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   273
  \frametitle{Code Layout}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   274
  \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   275
        \item Indentation
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   276
        \item Tabs or Spaces?
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   277
        \item Maximum Line Length
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   278
        \item Blank Lines
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   279
        \item Encodings
433
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   280
        \item Consider any legible book
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   281
   \end{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   282
\end{frame}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   283
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   284
\begin{frame}{Whitespaces in Expressions}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   285
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   286
        \item When to use extraneous whitespaces?
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   287
        \item When to avoid extra whitespaces?
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   288
        \item Use one statement per line
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   289
   \end{itemize}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   290
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   291
434
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   292
\begin{frame}[fragile]
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   293
 \frametitle{Whitespace}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   294
 Whitespace... it's not just for compilers!
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   295
  \begin{lstlisting}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   296
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   297
def myfanfunc(somevar,another,yetmore):
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   298
    if a%b==0:return b
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   299
    return myfanfunc(b,a%b)
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   300
      
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   301
  \end{lstlisting}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   302
\end{frame}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   303
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   304
\begin{frame}[fragile]
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   305
 \frametitle{Whitespace}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   306
 The compiler doesn't care!  Humans do!
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   307
  \begin{lstlisting}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   308
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   309
def my_fan_func(some_var, another, yet_more):
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   310
    if a % b == 0:
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   311
        return b
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   312
    return my_fan_func(b, a % b)
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   313
      
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   314
  \end{lstlisting}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   315
\end{frame}
99e1af343b04 DOC: More slides on whitespace.
Christopher Burns <chris.d.burns@gmail.com>
parents: 433
diff changeset
   316
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   317
\begin{frame}{Comments}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   318
  \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   319
        \item No comments better than contradicting comments
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   320
        \item Block comments
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   321
        \item Inline comments
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   322
   \end{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   323
\end{frame}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   324
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   325
\begin{frame}{Docstrings}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   326
  \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   327
        \item When to write docstrings?
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   328
        \item Ending the docstrings
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   329
        \item One liner docstrings
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   330
   \end{itemize}
433
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   331
\end{frame}
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   332
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   333
\begin{frame}{The Python Style Guide}
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   334
  \begin{itemize}
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   335
   \item PEP8
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   336
   \item PEP8
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   337
   \item PEP8
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   338
   \item \url{http://www.python.org/dev/peps/pep-0008/}
af45c8da1d5d DOC: Add comments about python style.
Christopher Burns <chris.d.burns@gmail.com>
parents: 432
diff changeset
   339
   \end{itemize}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   340
\end{frame}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   341
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   342
\section{Debugging}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   343
\subsection{Errors and Exceptions}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   344
\begin{frame}[fragile]
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   345
 \frametitle{Errors}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   346
 \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   347
In []: while True print 'Hello world'
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   348
 \end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   349
\pause
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   350
  \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   351
  File "<stdin>", line 1, in ?
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   352
    while True print 'Hello world'
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   353
                   ^
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   354
SyntaxError: invalid syntax
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   355
\end{lstlisting}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   356
\end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   357
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   358
\begin{frame}[fragile]
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   359
 \frametitle{Exceptions}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   360
 \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   361
In []: print spam
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   362
\end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   363
\pause
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   364
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   365
Traceback (most recent call last):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   366
  File "<stdin>", line 1, in <module>
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   367
NameError: name 'spam' is not defined
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   368
\end{lstlisting}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   369
\end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   370
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   371
\begin{frame}[fragile]
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   372
 \frametitle{Exceptions}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   373
 \begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   374
In []: 1 / 0
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   375
\end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   376
\pause
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   377
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   378
Traceback (most recent call last):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   379
  File "<stdin>", line 1, in <module>
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   380
ZeroDivisionError: integer division 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   381
or modulo by zero
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   382
\end{lstlisting}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   383
\end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   384
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   385
\begin{frame}[fragile]
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   386
  \frametitle{Processing user input}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   387
  \begin{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   388
prompt = 'Enter a number(Q to quit): '
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   389
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   390
a = raw_input(prompt)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   391
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   392
num = int(a) if a != 'Q' else 0
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   393
  \end{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   394
  \emphbar{What if the user enters some other alphabet?}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   395
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   396
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   397
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   398
\begin{frame}[fragile]
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   399
  \frametitle{Handling Exceptions}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   400
  Python provides \typ{try} and \typ{except} clause.
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   401
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   402
prompt = 'Enter a number(Q to quit): '
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   403
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   404
a = raw_input(prompt)
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   405
try:
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   406
    num = int(a)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   407
    print num
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   408
except:
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   409
    if a == 'Q':
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   410
        print "Exiting ..."
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   411
    else:
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   412
        print "Wrong input ..."
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   413
  \end{lstlisting}  
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   414
\end{frame}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   415
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   416
\subsection{Strategy}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   417
\begin{frame}[fragile]
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   418
    \frametitle{Debugging effectively}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   419
    \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   420
        \item \typ{print} based strategy
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   421
        \item Process:
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   422
    \end{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   423
\begin{center}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   424
\pgfimage[interpolate=true,width=5cm,height=5cm]{DebugginDiagram.png}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   425
\end{center}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   426
\end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   427
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   428
\begin{frame}[fragile]
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   429
    \frametitle{Debugging effectively}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   430
    \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   431
      \item Using \typ{\%debug} in IPython
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   432
    \end{itemize}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   433
\end{frame}
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   434
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   435
\begin{frame}[fragile]
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   436
\frametitle{Debugging in IPython}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   437
\small
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   438
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   439
In []: import mymodule
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   440
In []: mymodule.test()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   441
---------------------------------------------
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   442
NameError   Traceback (most recent call last)
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   443
<ipython console> in <module>()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   444
mymodule.py in test()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   445
      1 def test():
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   446
----> 2     print spam
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   447
NameError: global name 'spam' is not defined
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   448
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   449
In []: %debug
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   450
> mymodule.py(2)test()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   451
      0     print spam
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   452
ipdb> 
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   453
\end{lstlisting}
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   454
\inctime{15} 
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   455
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   456
435
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   457
\begin{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   458
\frametitle{The Python Debugger}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   459
\url{http://docs.python.org/library/pdb.html}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   460
\end{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   461
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   462
\subsection{Exercise}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   463
\begin{frame}[fragile]
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   464
\frametitle{Debugging: Exercise}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   465
\small
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   466
\begin{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   467
science = {}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   468
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   469
for record in open('sslc1.txt'):
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   470
    fields = record.split(';')
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   471
    region_code = fields[0].strip()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   472
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   473
    score_str = fields[6].strip()
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   474
    score = int(score_str) if score_str != 'AA' 
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   475
                           else 0
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   476
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   477
    if score > 90:
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   478
        science[region_code] += 1
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   479
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   480
pie(science.values(), labels=science.keys())
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   481
savefig('science.png')
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   482
\end{lstlisting}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   483
\inctime{10}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   484
\end{frame}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   485
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   486
\begin{frame}
435
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   487
 \frametitle{Documentation}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   488
  \begin{itemize}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   489
    \item Python: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   490
      \url{http://docs.python.org/}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   491
    \item Scipy \& Numpy: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   492
      \url{http://docs.scipy.org/doc/}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   493
    \item IPython: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   494
      \url{http://ipython.scipy.org/moin/Documentation}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   495
     \item Matplotlib: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   496
      \url{http://matplotlib.sourceforge.net/}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   497
  \end{itemize}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   498
\end{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   499
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   500
\begin{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   501
 \frametitle{Packages}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   502
 Home for packages
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   503
  \begin{itemize}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   504
   \item Python Package Index: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   505
    \url{http://pypi.python.org/pypi}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   506
  \end{itemize}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   507
\end{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   508
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   509
\begin{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   510
 \frametitle{Mailing lists}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   511
   \begin{itemize}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   512
   \item numpy-discussion \& Scipy-User: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   513
    \url{http://scipy.org/Mailing_Lists}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   514
   \item matplotlib-users: \linebreak
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   515
     \url{http://sourceforge.net/mail/?group_id=80706}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   516
  \end{itemize}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   517
\end{frame}
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   518
2aed1dda7909 DOC: Add mailing lists and other links.
Christopher Burns <chris.d.burns@gmail.com>
parents: 434
diff changeset
   519
\begin{frame}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   520
  \frametitle{Summary}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   521
We have covered:
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   522
  \begin{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   523
  \item Following and Resolving Error Messages.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   524
  \item Exceptions.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   525
  \item Handling exceptions
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   526
  \item Approach for Debugging.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   527
%  \item Writting and running tests.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   528
  \end{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   529
\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   530
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   531
\end{document}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   532
344
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   533
%% \begin{frame}[fragile]
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   534
%%     \frametitle{\incqno}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   535
%%     Consider a module called \lstinline+gcd.py+ looking like this:
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   536
%%     \begin{lstlisting}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   537
%% def gcd(a, b):
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   538
%%    ...
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   539
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   540
%% if __name__ == '__main__':
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   541
%%     print gcd(10, 25)
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   542
%%     \end{lstlisting}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   543
%% If this module is imported, will it print the gcd of 10 and 25?
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   544
%% \end{frame}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   545
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   546
%% \begin{frame}[fragile]
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   547
%%     \frametitle{\incqno}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   548
%%   \begin{lstlisting}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   549
%% In [1]: print hello 
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   550
%%   \end{lstlisting}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   551
%%   Exactly what exception will you get if you run this on a fresh
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   552
%%   interpreter?
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   553
%% \end{frame}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   554
289
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   555
%% \begin{frame}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   556
%%     \frametitle{Testing}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   557
   
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   558
%%     \begin{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   559
%%         \item Writing tests is really simple!
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   560
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   561
%%         \item Using nose.
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   562
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   563
%%         \item Example!
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   564
%%     \end{itemize}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   565
%% \end{frame}
884d42eff66d Reorganized last 3 sessions of day 2 again.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   566
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   567
% \section{Test Driven Approach}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   568
% \begin{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   569
%     \frametitle{Need for Testing!}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   570
%    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   571
%     \begin{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   572
%         \item Quality
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   573
%         \item Regression
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   574
%         \item Documentation
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   575
%     \end{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   576
%     %% \vspace*{0.25in}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   577
%     %% \emphbar{It is to assure that section of code is working as it is supposed to work}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   578
% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   579
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   580
% \begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   581
%     \frametitle{Example}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   582
%     \begin{block}{Problem Statement}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   583
%       Write a function to check whether a given input
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   584
%       string is a palindrome.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   585
%     \end{block}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   586
% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   587
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   588
% \begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   589
%     \frametitle{Function: palindrome.py}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   590
% \begin{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   591
% def is_palindrome(input_str):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   592
%   return input_str == input_str[::-1]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   593
% \end{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   594
% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   595
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   596
% \begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   597
%     \frametitle{Test for the palindrome: palindrome.py}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   598
% \begin{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   599
% def test_function_normal_words():
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   600
%   input = "noon"
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   601
%   assert is_palindrome(input) == True
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   602
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   603
% if __name__ == "main'':
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   604
%   test_function_normal_words()
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   605
% \end{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   606
% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   607
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   608
% \begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   609
%     \frametitle{Running the tests.}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   610
% \begin{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   611
% $ nosetests palindrome.py 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   612
% .
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   613
% ----------------------------------------------
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   614
% Ran 1 test in 0.001s
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   615
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   616
% OK
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   617
% \end{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   618
% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   619
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   620
% \begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   621
%     \frametitle{Exercise: Including new tests.}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   622
% \begin{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   623
% def test_function_ignore_cases_words():
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   624
%   input = "Noon"
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   625
%   assert is_palindrome(input) == True
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   626
% \end{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   627
%      \vspace*{0.25in}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   628
%      Check\\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   629
%      \PythonCode{$ nosetests palindrome.py} \\
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   630
%      \begin{block}{Task}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   631
%      Tweak the code to pass this test.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   632
%      \end{block}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   633
% \end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   634
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   635
% %\begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   636
% %    \frametitle{Lets write some test!}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   637
% %\begin{lstlisting}    
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   638
% %#for form of equation y=mx+c
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   639
% %#given m and c for two equation,
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   640
% %#finding the intersection point.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   641
% %def intersect(m1,c1,m2,c2):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   642
% %    x = (c2-c1)/(m1-m2)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   643
% %    y = m1*x+c1
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   644
% %    return (x,y)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   645
% %\end{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   646
% %
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   647
% %Create a simple test for this
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   648
% %
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   649
% %function which will make it fail.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   650
% %
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   651
% %\inctime{15} 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   652
% %\end{frame}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   653
% %
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   654
% 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   655
% %% \begin{frame}[fragile]
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   656
% %%     \frametitle{Exercise}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   657
% %%     Based on Euclid's algorithm:
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   658
% %%     \begin{center}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   659
% %%     $gcd(a,b)=gcd(b,b\%a)$
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   660
% %%     \end{center}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   661
% %%     gcd function can be written as:
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   662
% %%     \begin{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   663
% %%     def gcd(a, b):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   664
% %%       if a%b == 0: return b
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   665
% %%       return gcd(b, a%b)
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   666
% %%     \end{lstlisting}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   667
% %%     \vspace*{-0.15in}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   668
% %%     \begin{block}{Task}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   669
% %%       \begin{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   670
% %%       \item Write at least 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   671
% %%         two tests for above mentioned function.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   672
% %%       \item Write a non recursive implementation
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   673
% %%       of gcd(), and test it using already 
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   674
% %%       written tests.
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   675
% %%       \end{itemize}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   676
% %%     \end{block}
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   677
%     
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 289
diff changeset
   678
% %% \inctime{15} 
330
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 297
diff changeset
   679
% %% \end{frame}