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