day1/Session-1.tex
author Santosh G. Vattam <vattam.santosh@gmail.com>
Wed, 07 Oct 2009 15:12:17 +0530
changeset 52 fccb3551c7d5
parent 48 7f4c51382f89
child 53 fc74987a475d
permissions -rwxr-xr-x
Updated Session-1.tex as per suggestions from yesterday.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
% Tutorial slides on Python.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
46
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 42
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    15
\mode<presentation>
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
{
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    17
  \usetheme{Warsaw}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    18
  \useoutertheme{split}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    20
}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    21
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    22
\usepackage[english]{babel}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    24
%\usepackage{times}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    26
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    27
% Taken from Fernando's slides.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    31
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    33
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    34
\usepackage{listings}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    35
\lstset{language=Python,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    36
    basicstyle=\ttfamily,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    39
  showstringspaces=false,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    41
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    43
% Macros
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    47
      {#1}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    48
 \end{beamercolorbox}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    49
}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    50
\newcounter{time}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    51
\setcounter{time}{0}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    53
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    54
\newcommand{\typ}[1]{\texttt{#1}}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    55
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    57
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    58
%%% This is from Fernando's setup.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    59
% \usepackage{color}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    60
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    61
% % Use and configure listings package for nicely formatted code
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    62
% \usepackage{listings}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    63
% \lstset{
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    64
%    language=Python,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    65
%    basicstyle=\small\ttfamily,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    66
%    commentstyle=\ttfamily\color{blue},
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    67
%    stringstyle=\ttfamily\color{orange},
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    68
%    showstringspaces=false,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    69
%    breaklines=true,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    70
%    postbreak = \space\dots
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    71
% }
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    72
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    73
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    75
% Title page
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    76
\title[Basic Python]{Python:\\A great programming toolkit}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    77
46
63704b5650f1 Changed the copyright and Institute for all the sessions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 42
diff changeset
    78
\author[FOSSEE Team] {Asokan Pichai\\Prabhu Ramachandran}
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    79
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
47
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
    81
\date[] {Day 1, Session-1, 10, October 2009}
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    83
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    86
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    87
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    89
%% the beginning of each subsection:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    90
\AtBeginSubsection[]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    91
{
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    92
  \begin{frame}<beamer>
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    93
    \frametitle{Outline}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    95
  \end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    96
}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    97
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    98
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    99
% If you wish to uncover everything in a step-wise fashion, uncomment
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   100
% the following command: 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   101
%\beamerdefaultoverlayspecification{<+->}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   102
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   103
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   104
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   105
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   106
% DOCUMENT STARTS
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   107
\begin{document}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   108
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   109
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   110
  \titlepage
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   111
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   112
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   113
  {Acknowledgements}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   114
  \begin{center}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   115
  This program is conducted by\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   116
  IIT, Bombay\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   117
  through CDEEP\\as part of  the open source initiatives\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   118
  under the aegis of\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   119
  \alert{National Mission on Education through ICT,} \\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   120
  Ministry of HRD.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   121
  \end{center}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   122
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   123
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   124
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   125
  \frametitle{Outline}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   126
  \tableofcontents
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   127
  % You might wish to add the option [pausesections]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   128
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   129
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   130
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   131
% TODO
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   132
%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   133
%  * Add slide on Python packages (modules)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   134
%  * Add slides on reference counting.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   135
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   136
\section{Agenda}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   137
\begin{frame}{About the Workshop}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   138
  \begin{description}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   139
	\item[Day 1, Session 1] Sat 09:30--11:00
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   140
	\item[Day 1, Session 2] Sat 11:15--12:45
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   141
	\item[Day 1, Session 3] Sat 13:45--15:15
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   142
	\item[Day 1, Session 4] Sat 15:30--17:00
47
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   143
        \item[Day 2, Quiz] Sun 09:00--09:30
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   144
        \item[Day 2, Session 1] Sun 09:30--11:00
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   145
	\item[Day 2, Session 2] Sun 11:15--12:45
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   146
	\item[Day 2, Session 3] Sun 13:45--15:15
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   147
	\item[Day 2, Session 4] Sun 15:30--17:00
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   148
  \end{description}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   149
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   150
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   151
\begin{frame}{About the Workshop}
47
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   152
  \begin{block}{Intended Audience}
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   153
  \begin{itemize}
47
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   154
       \item Aimed at Engg., Mathematics and Science teachers.
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   155
       \item Interested students from similar streams.
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   156
  \end{itemize}
47
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   157
  \end{block}  
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   158
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   159
  \begin{block}{Goal}
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   160
	Successful participants will be able to use python as their scripting and problem solving language. 
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   161
  \end{block}
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   162
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   163
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   164
\begin{frame}{Checklist}
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   165
        \begin {block}{Live Python}
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   166
          Have you booted using the Live Python DVD?
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   167
        \end {block}
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   168
	\begin{block}{python}
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   169
          Type python at the command line. Do you see version 2.5 or later?
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   170
        \end{block}
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   171
        \begin{block}{IPython}
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   172
          Type ipython at the command line. Is it available?
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   173
        \end{block}
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   174
        \begin{block}{Editor}
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   175
          We recommend scite. 
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   176
        \end{block}
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   177
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   178
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   179
\section{Overview}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   180
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   181
  \frametitle{Introduction}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   182
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   183
  \item Creator and BDFL: Guido van Rossum
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   184
  \item December 1989
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   185
  \item ``Python'' as in \emph {Monty Python's Flying Circus}
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   186
  \item 2.6.x
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   187
  \item PSF license (like BSD: no strings attached)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   188
  \item Highly cross platform
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   189
  \item Nokia series 60!
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   190
  \item \alert{Philosophy:} Simple and complete by design
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   191
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   192
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   193
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   194
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   195
  \frametitle{Resources}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   196
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   197
  \item Part of many GNU/Linux distributions
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   198
  \item Web: \url{http://www.python.org}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   199
  \item Doc: \url{http://www.python.org/doc}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   200
  \item Free Tutorials:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   201
    \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   202
    \item Official Python tutorial: \url{http://docs.python.org/tut/tut.html}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   203
    \item Byte of Python: \url{http://www.byteofpython.info/}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   204
    \item Dive into Python: \url{http://diveintopython.org/}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   205
    \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   206
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   207
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   208
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   209
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   210
  \frametitle{Why Python?}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   211
  \begin{itemize}
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   212
  \item Readable and easy to use
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   213
  \item High level, interpreted, modular, OO
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   214
  \item Much faster development cycle
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   215
  \item Powerful interactive environment
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   216
  \item Rapid application development
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   217
  \item Rich standard library and modules
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   218
  \item Interfaces well with C++, C and FORTRAN
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   219
  \item \alert{More than a math package $\Rightarrow$ some extra work compared to math packages}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   220
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   221
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   222
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   223
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   224
  \frametitle{Use cases}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   225
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   226
  \item NASA: Space Shuttle Mission Design
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   227
  \item AstraZeneca: Collaborative Drug Discovery
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   228
  \item ForecastWatch.com: Helps Meteorologists
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   229
  \item Industrial Light \& Magic: Runs on Python
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   230
  \item Zope: Commercial grade Toolkit
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   231
  \item Plone: Professional high feature CMS
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   232
  \item RedHat: install scripts, sys-admin tools
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   233
  \item Django: A great web application framework
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   234
  \item Google: A strong python shop
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   235
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   236
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   237
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   238
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   239
  \frametitle{To sum up, python is\ldots}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   240
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   241
  \item dynamically typed, interpreted $\rightarrow$ rapid testing/prototyping
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   242
  \item powerful, very high level
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   243
  \item has full introspection 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   244
  \item Did we mention powerful?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   245
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   246
  \begin{block}{But \ldots}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   247
    may be wanting in performance. specialised resources such as SWIG, \alert{Cython} are available 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   248
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   249
  \inctime{15}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   250
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   251
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   252
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   253
% TIME: 10 m, running 10m
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   254
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   255
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   256
\section{Python}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   257
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   258
\subsection{Getting Started}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   259
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   260
\begin{frame}[fragile]{At the prompt, type the following}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   261
   \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   262
>>> print 'Hello Python' 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   263
>>> print 3124 * 126789
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   264
>>> 1786 % 12
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   265
>>> 3124 * 126789
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   266
>>> a = 3124 * 126789
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   267
>>> big = 12345678901234567890 ** 3
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   268
>>> verybig = big * big * big * big 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   269
>>> 12345**6, 12345**67, 12345**678
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   270
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   271
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   272
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   273
\begin{frame}[fragile]{At the prompt, type the following}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   274
   \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   275
>>> s = 'Hello '
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   276
>>> p = 'World'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   277
>>> s + p 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   278
>>> s * 12 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   279
>>> s * s
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   280
>>> s + p * 12, (s + p)* 12
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   281
>>> s * 12 + p * 12
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   282
>>> 12 * s 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   283
    \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   284
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   285
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   286
\begin{frame}[fragile]{At the prompt, type the following}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   287
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   288
>>> 17/2
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   289
>>> 17/2.0
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   290
>>> 17.0/2
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   291
>>> 17.0/8.5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   292
>>> int(17/2.0)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   293
>>> float(17/2)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   294
>>> str(17/2.0)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   295
>>> round( 7.5 )
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   296
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   297
  \begin{block}{Mini exercise}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   298
	Round a float to the nearest integer, using \texttt{int()}?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   299
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   300
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   301
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   302
\begin{frame}{Midi exercises}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   303
  \begin{center}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   304
    \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   305
      \item What does this do?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   306
      \item \texttt{round(amount * 10) /10.0 }
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   307
    \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   308
  \end{center}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   309
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   310
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   311
\begin{frame}{More exercises?}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   312
  \begin{center}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   313
    \begin{block}{Round sums}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   314
      How to round a number to the nearest  5 paise?\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   315
      \begin{description}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   316
        \item[Remember] 17.23 $\rightarrow$ 17.25,\\ while 17.22 $\rightarrow$ 17.20\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   317
      \end{description}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   318
      How to round a number to the nearest 20 paise?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   319
    \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   320
  \end{center}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   321
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   322
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   323
\begin{frame}[fragile] {A question of good style}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   324
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   325
    amount = 12.68
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   326
    denom = 0.05
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   327
    nCoins = round(amount/denom)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   328
    rAmount = nCoins * denom
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   329
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   330
  \pause
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   331
  \begin{block}{Style Rule \#1}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   332
    Naming is 80\% of programming
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   333
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   334
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   335
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   336
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   337
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   338
  \frametitle{Odds and ends}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   339
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   340
    \item Case sensitive
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   341
    \item Dynamically typed $\Rightarrow$ need not specify a type
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   342
      \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   343
a = 1
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   344
a = 1.1
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   345
a = "Now I am a string!"
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   346
      \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   347
    \item Comments:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   348
      \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   349
a = 1  # In-line comments
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   350
# Comment in a line to itself.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   351
a = "# This is not a comment!"
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   352
      \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   353
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   354
  \inctime{15}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   355
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   356
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   357
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   358
% TIME: 10 m, running 20m
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   359
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   360
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   361
\subsection{Data types}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   362
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   363
  \frametitle{Basic types}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   364
  \begin{itemize}
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   365
    \item Numbers: float, int, long, complex
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   366
    \item Strings
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   367
    \item Boolean
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   368
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   369
  \begin{block}{Also to be discussed later}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   370
    tuples, lists, dictionaries, functions, objects\ldots
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   371
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   372
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   373
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   374
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   375
  \frametitle{Numbers}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   376
  \vspace*{-0.25in}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   377
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   378
>>> a = 1 # Int.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   379
>>> l = 1000000L # Long
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   380
>>> e = 1.01325e5 # float
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   381
>>> f = 3.14159 # float
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   382
>>> c = 1+1j # Complex!
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   383
>>> print f*c/a
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   384
(3.14159+3.14159j)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   385
>>> print c.real, c.imag
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   386
1.0 1.0
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   387
>>> abs(c)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   388
1.4142135623730951
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   389
>>> abs( 8 - 9.5 )
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   390
1.5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   391
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   392
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   393
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   394
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   395
  \frametitle{Boolean}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   396
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   397
>>> t = True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   398
>>> f = not t
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   399
False
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   400
>>> f or t
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   401
True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   402
>>> f and t
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   403
False
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   404
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   405
  \begin{block}{Try:}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   406
  NOT True\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   407
  not TRUE
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   408
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   409
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   410
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   411
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   412
% TIME: 10 m, running 30m
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   413
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   414
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   415
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   416
  \frametitle{Relational and logical operators}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   417
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   418
>>> a, b, c = -1, 0, 1
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   419
>>> a == b
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   420
False
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   421
>>> a <= b 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   422
True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   423
>>> a + b != c
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   424
True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   425
>>> a < b < c
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   426
True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   427
>>> c >= a + b
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   428
True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   429
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   430
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   431
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   432
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   433
  \frametitle{Strings}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   434
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   435
s = 'this is a string'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   436
s = 'This one has "quotes" inside!'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   437
s = "I have 'single-quotes' inside!"
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   438
l = "A string spanning many lines\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   439
one more line\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   440
yet another"
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   441
t = """A triple quoted string does
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   442
not need to be escaped at the end and 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   443
"can have nested quotes" etc."""
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   444
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   445
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   446
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   447
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   448
  \frametitle{More Strings}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   449
  \vspace*{-0.2in}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   450
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   451
>>> w = "hello"    
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   452
>>> print w[0] + w[2] + w[-1]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   453
hlo
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   454
>>> len(w) # guess what
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   455
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   456
>>> s = u'Unicode strings!'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   457
>>> # Raw strings (note the leading 'r')
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   458
... r_s = r'A string $\alpha \nu$'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   459
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   460
\pause
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   461
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   462
>>> w[0] = 'H' # Can't do that!
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   463
Traceback (most recent call last):
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   464
  File "<stdin>", line 1, in ?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   465
TypeError: object does not support item assignment
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   466
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   467
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   468
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   469
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   470
  \frametitle{Let us switch to IPython}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   471
  Why?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   472
  \begin{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   473
    {Better help (and a lot more)}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   474
    Tab completion\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   475
    ?\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   476
    .?\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   477
    object.function?
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   478
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   479
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   480
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   481
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   482
  \frametitle{More on strings}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   483
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   484
In [1]: a = 'hello world'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   485
In [2]: a.startswith('hell')
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   486
Out[2]: True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   487
In [3]: a.endswith('ld')
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   488
Out[3]: True
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   489
In [4]: a.upper()
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   490
Out[4]: 'HELLO WORLD'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   491
In [5]: a.upper().lower()
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   492
Out[5]: 'hello world'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   493
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   494
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   495
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   496
\begin{frame}[fragile]{Still with strings}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   497
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   498
In [6]: a.split()
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   499
Out[6]: ['hello', 'world']
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   500
In [7]: ''.join(['a', 'b', 'c'])
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   501
Out[7]: 'abc'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   502
In [8] 'd' in ''.join( 'a', 'b', 'c')
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   503
Out[8]: False
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   504
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   505
  \begin{block}{Try:}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   506
    \texttt{a.split( 'o' )}\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   507
    \texttt{'x'.join( a.split( 'o' ) )}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   508
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   509
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   510
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   511
\begin{frame}[fragile]{Surprise! strings!!}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   512
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   513
In [11]: x, y = 1, 1.2
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   514
In [12]: 'x is %s, y is %s' %(x, y)
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   515
Out[12]: 'x is 1, y is 1.234'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   516
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   517
  \begin{block}{Try:}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   518
    \texttt{'x is \%d, y is \%f' \%(x, y) }\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   519
    \texttt{'x is \%3d, y is \%4.2f' \%(x, y) }
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   520
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   521
  \small
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   522
\url{docs.python.org/lib/typesseq-strings.html}\\
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   523
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   524
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   525
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   526
  {Interlude}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   527
  \begin{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   528
    {A classic problem}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   529
    How to interchange values of two variables? Please note that the type of either variable is unknown and it is not necessary that both be of the same type even!
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   530
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   531
  \inctime{30}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   532
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   533
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   534
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   535
% TIME: 25 m+ Interlude break 5 mins, running 60m 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   536
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   537
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   538
\subsection{Control flow}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   539
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   540
  \frametitle{Control flow constructs}  
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   541
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   542
  \item \kwrd{if/elif/else}: branching
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   543
  \item \kwrd{while}: looping
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   544
  \item \kwrd{for}: iterating 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   545
  \item \kwrd{break, continue}: modify loop 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   546
  \item \kwrd{pass}: syntactic filler
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   547
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   548
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   549
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   550
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   551
  \frametitle{Basic conditional flow}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   552
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   553
In [21]: a = 7
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   554
In [22]: b = 8
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   555
In [23]: if a > b:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   556
   ....:    print 'Hello'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   557
   ....: else:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   558
   ....:     print 'World'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   559
   ....:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   560
   ....:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   561
World
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   562
  \end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   563
  Let us switch to creating a file
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   564
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   565
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   566
\begin{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   567
  {Creating python files}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   568
  \begin{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   569
    \item aka scripts
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   570
    \item use your editor
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   571
    \item Note that white space is the way to specify blocks!
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   572
    \item extension \typ{.py}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   573
    \item run with \texttt{python hello.py} at the command line
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   574
    \item in IPython\ldots
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   575
  \end{itemize}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   576
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   577
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   578
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   579
  \frametitle{\typ{If...elif...else} example}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   580
\begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   581
x = int(raw_input("Enter an integer:"))
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   582
if x < 0:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   583
     print 'Be positive!'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   584
elif x == 0:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   585
     print 'Zero'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   586
elif x == 1:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   587
     print 'Single'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   588
else:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   589
     print 'More'
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   590
\end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   591
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   592
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   593
\begin{frame}{Simple IO}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   594
  \begin{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   595
    {Console Input}
24
95fdc10975d5 Session 1 slides cleaned up. Waiting for review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 5
diff changeset
   596
    \texttt{raw\_input()} waits for user input.\\Prompt string is optional.\\
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   597
    All keystrokes are Strings!\\\texttt{int()} converts string to int.
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   598
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   599
  \begin{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   600
    {Console output}
47
21de307e6823 Updated session 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 42
diff changeset
   601
    \texttt{print} is straight forward. Note the distinction between \texttt{print x} and \texttt{print x,}
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   602
  \end{block}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   603
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   604
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   605
\begin{frame}[fragile]
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   606
  \frametitle{Basic looping}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   607
  \begin{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   608
# Fibonacci series:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   609
# the sum of two elements
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   610
# defines the next
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   611
a, b = 0, 1
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   612
while b < 10:
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   613
    print b,
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   614
    a, b = b, a + b
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   615
 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   616
\end{lstlisting}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   617
\typ{1 1 2 3 5 8}\\  
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   618
\alert{Recall it is easy to write infinite loops with \kwrd{while}}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   619
  \inctime{20}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   620
\end{frame}
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   621
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   622
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   623
% TIME: 20 m, running 80m 
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   624
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   625
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   626
\section{Session Summary}
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   627
\begin{frame}{So what have we learnt so far?}
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   628
  \begin{itemize}
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   629
    \item The interactive interpreter
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   630
    \item Basic Data Types-Numbers
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   631
    \item \typ{if/elif/else, while}
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   632
    \item Simple IO
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   633
    \item Creating and running a Python script
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   634
  \end{itemize}
fccb3551c7d5 Updated Session-1.tex as per suggestions from yesterday.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 48
diff changeset
   635
\end{frame}
5
838cedef5e9d Added 4 tex slides for 4 sessions of Day 1 of the workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
   636
\end{document}