day2/session1.tex
author Puneeth Chaganti <punchagan@fossee.in>
Thu, 05 Nov 2009 09:22:27 +0530
changeset 271 3f32f679bb45
parent 250 760d5679834e
child 288 c4e25269a86c
permissions -rw-r--r--
Retained only fsolve and roots in finding roots, session6.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     2
%Tutorial slides on Python.
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     3
%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     7
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    13
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    15
\mode<presentation>
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    16
{
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    17
  \usetheme{Warsaw}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 227
diff changeset
    18
  \useoutertheme{infolines}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    20
}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    21
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    22
\usepackage[english]{babel}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    24
%\usepackage{times}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    26
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    27
% Taken from Fernando's slides.
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    31
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    33
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    34
\usepackage{listings}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    35
\lstset{language=Python,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    36
    basicstyle=\ttfamily\bfseries,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    39
  showstringspaces=false,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    41
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    43
% Macros
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    47
      {#1}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    48
 \end{beamercolorbox}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    49
}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    50
\newcounter{time}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    51
\setcounter{time}{0}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    53
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    54
\newcommand{\typ}[1]{\texttt{#1}}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    55
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    57
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    58
%%% This is from Fernando's setup.
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    59
% \usepackage{color}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    60
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    61
% % Use and configure listings package for nicely formatted code
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    62
% \usepackage{listings}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    63
% \lstset{
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    64
%    language=Python,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    65
%    basicstyle=\small\ttfamily,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    66
%    commentstyle=\ttfamily\color{blue},
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    67
%    stringstyle=\ttfamily\color{orange},
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    68
%    showstringspaces=false,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    69
%    breaklines=true,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    70
%    postbreak = \space\dots
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    71
% }
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    72
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    73
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    75
% Title page
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
    76
\title[Basic Python]{Python language: Basics}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    77
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    78
\author[FOSSEE Team] {The FOSSEE Group}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    79
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    81
\date[] {1, November 2009\\Day 2, Session 1}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    83
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    86
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    87
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    89
%% the beginning of each subsection:
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    90
\AtBeginSubsection[]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    91
{
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    92
  \begin{frame}<beamer>
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    93
    \frametitle{Outline}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    95
  \end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    96
}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    97
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    98
\AtBeginSection[]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    99
{
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   100
  \begin{frame}<beamer>
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   101
    \frametitle{Outline}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   102
    \tableofcontents[currentsection,currentsubsection]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   103
  \end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   104
}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   105
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   106
% If you wish to uncover everything in a step-wise fashion, uncomment
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   107
% the following command: 
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   108
%\beamerdefaultoverlayspecification{<+->}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   109
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   110
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   111
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   113
% DOCUMENT STARTS
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   114
\begin{document}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   115
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   116
\begin{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   117
  \titlepage
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   118
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   119
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   120
\begin{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   121
  \frametitle{Outline}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   122
  \tableofcontents
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   123
  % You might wish to add the option [pausesections]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   124
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   125
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   126
\section{Data types}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   127
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   128
\begin{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   129
  \frametitle{Primitive Data types}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   130
  \begin{itemize}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   131
    \item Numbers: float, int, complex
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   132
    \item Strings
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   133
    \item Boolean
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   134
  \end{itemize}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   135
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   136
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   137
\subsection{Numbers}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   138
\begin{frame}[fragile]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   139
  \frametitle{Numbers}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   140
  \begin{itemize}
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   141
    \item \kwrd{int}\\ \kwrd{int} = whole number, no matter what the size!
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   142
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   143
In [1]: a = 13
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   144
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   145
In [2]: b = 99999999999999999999
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   146
  \end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   147
    \item \kwrd{float}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   148
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   149
In [3]: fl = 3.141592
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   150
  \end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   151
  \end{itemize}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   152
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   153
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   154
\begin{frame}[fragile]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   155
\frametitle{Complex numbers}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   156
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   157
In [1]: cplx = 3+4j
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   158
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   159
In [2]: abs(cplx)
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   160
Out[2]: 5.0
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   161
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   162
In [3]: cplx.imag
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   163
Out[3]: 4.0
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   164
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   165
In [4]: cplx.real
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   166
Out[4]: 3.0
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   167
  \end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   168
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   169
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   170
\subsection{Boolean}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   171
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   172
  \frametitle{Boolean}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   173
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   174
In [1]: t = True
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   175
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   176
In [2]: f = not t
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   177
Out[2]: False
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   178
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   179
In [3]: f or t
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   180
Out[3]: True
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   181
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   182
In [4]: f and t
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   183
Out[4]: False
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   184
  \end{lstlisting}
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   185
  \inctime{5}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   186
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   187
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   188
\subsection{Strings}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   189
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   190
\begin{frame}[fragile]
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   191
  \frametitle{Strings}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   192
Strings were introduced previously, let us now look at them in a little more detail.
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   193
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   194
In [1]: w = "hello"
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   195
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   196
In [2]: print w[0] + w[2] + w[-1]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   197
Out[2]: hlo
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   198
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   199
In [3]: len(w) # guess what
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   200
Out[3]: 5
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   201
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   202
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   203
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   204
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   205
  \frametitle{Strings \ldots}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   206
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   207
In [1]: w[0] = 'H' # Can't do that!
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   208
--------------------------------------------
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   209
TypeError  Traceback (most recent call last)
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   210
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   211
/<ipython console> in <module>()
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   212
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   213
TypeError: 'str' object does not
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   214
         support item assignment
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   215
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   216
\end{frame}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   217
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   218
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   219
  \frametitle{String methods}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   220
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   221
In [1]: a = 'Hello World'
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   222
In [2]: a.startswith('Hell')
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   223
Out[2]: True
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   224
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   225
In [3]: a.endswith('ld')
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   226
Out[3]: True
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   227
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   228
In [4]: a.upper()
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   229
Out[4]: 'HELLO WORLD'
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   230
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   231
In [5]: a.lower()
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   232
Out[5]: 'hello world'
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   233
  \end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   234
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   235
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   236
\begin{frame}[fragile]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   237
\frametitle{Still with strings}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   238
  \begin{itemize}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   239
    \item We saw split() yesterday
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   240
    \item join() is the opposite of split()
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   241
  \end{itemize}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   242
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   243
In [1]: ''.join(['a', 'b', 'c'])
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   244
Out[1]: 'abc'
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   245
  \end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   246
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   247
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   248
\begin{frame}[fragile]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   249
\frametitle{String formatting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   250
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   251
In [1]: x, y = 1, 1.234
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   252
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   253
In [2]: 'x is %s, y is %s' %(x, y)
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   254
Out[2]: 'x is 1, y is 1.234'
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   255
  \end{lstlisting}
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   256
  \emphbar{\url{http://docs.python.org/library/stdtypes.html}}
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   257
  \inctime{10}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   258
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   259
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   260
\section{Operators}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   261
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   262
  \frametitle{Arithematic operators}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   263
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   264
In [1]: 1786 % 12
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   265
Out[1]: 10
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   266
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   267
In [2]: 3124 * 126789
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   268
Out[2]: 396088836
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   269
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   270
In [3]: a = 3124 * 126789
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   271
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   272
In [4]: big = 1234567891234567890 ** 3
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   273
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   274
In [5]: verybig = big * big * big * big
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   275
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   276
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   277
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   278
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   279
  \frametitle{Arithematic operators \ldots}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   280
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   281
In [1]: 17/2
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   282
Out[1]: 8
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   283
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   284
In [2]: 17/2.0
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   285
Out[2]: 8.5
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   286
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   287
In [3]: 17.0/2
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   288
Out[3]: 8.5
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   289
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   290
In [4]: 17.0/8.5
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   291
Out[4]: 2.0
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   292
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   293
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   294
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   295
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   296
  \frametitle{String operations}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   297
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   298
In [1]: s = 'Hello '
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   299
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   300
In [2]: p = 'World'
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   301
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   302
In [3]: s + p 
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   303
Out[3]: 'Hello World'
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   304
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   305
In [4]: s * 4
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   306
Out[4]: 'Hello Hello Hello Hello'
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   307
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   308
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   309
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   310
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   311
  \frametitle{String operations \ldots}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   312
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   313
In [1]: s * s
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   314
--------------------------------------------
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   315
TypeError  Traceback (most recent call last)
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   316
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   317
/<ipython console> in <module>()
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   318
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   319
TypeError: can't multiply sequence by
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   320
                non-int of type 'str'
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   321
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   322
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   323
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   324
\begin{frame}[fragile]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   325
  \frametitle{Relational and logical operators}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   326
  \begin{lstlisting}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   327
In [1]: pos, zer, neg = 1, 0, -1
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   328
In [2]: pos == neg
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   329
Out[2]: False
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   330
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   331
In [3]: pos >= neg
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   332
Out[3]: True
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   333
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   334
In [4]: neg < zer < pos
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   335
Out[4]: True
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   336
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   337
In [5]: pos + neg != zer
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   338
Out[5]: False
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   339
  \end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   340
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   341
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   342
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   343
  \frametitle{Built-ins}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   344
  \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   345
In [1]: int(17/2.0)
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   346
Out[1]: 8
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   347
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   348
In [2]: float(17/2)  # Recall
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   349
Out[2]: 8.0
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   350
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   351
In [3]: str(17/2.0)
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   352
Out[3]: '8.5'
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   353
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   354
In [4]: round( 7.5 )
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   355
Out[4]: 8.0
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   356
  \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   357
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   358
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   359
\begin{frame}[fragile]
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   360
  \frametitle{Odds and ends}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   361
  \begin{itemize}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   362
    \item Case sensitive
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   363
    \item Dynamically typed $\Rightarrow$ need not specify a type
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   364
      \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   365
In [1]: a = 1
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   366
In [2]: a = 1.1
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   367
In [3]: a = "Now I am a string!"
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   368
      \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   369
    \item Comments:
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   370
      \begin{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   371
In [4]: a = 1  # In-line comments
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   372
In [5]: # A comment line.
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   373
In [6]: a = "# Not a comment!"
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   374
      \end{lstlisting}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   375
  \end{itemize}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   376
  \inctime{15}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   377
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   378
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   379
\section{Simple IO}
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   380
\begin{frame}[fragile]
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   381
  \frametitle{Simple IO: Console Input}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   382
  \begin{itemize}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   383
    \item raw\_input() waits for user input.
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   384
      \begin{lstlisting}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   385
In [1]: a = raw_input()
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   386
5
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   387
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   388
In [2]: a = raw_input('prompt > ')
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   389
prompt > 5
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   390
      \end{lstlisting}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   391
    \item Prompt string is optional.
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   392
    \item All keystrokes are Strings!
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   393
    \item \texttt{int()} converts string to int.
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   394
  \end{itemize}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   395
\end{frame}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   396
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   397
\begin{frame}{Simple IO: Console output}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   398
  \begin{itemize}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   399
    \item \texttt{print} is straight forward
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   400
    \item Note the distinction between \texttt{print x} and \texttt{print x,}
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   401
  \end{itemize}
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   402
\end{frame}
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   403
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   404
\section{Control flow}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   405
\begin{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   406
  \frametitle{Control flow constructs}  
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   407
  \begin{itemize}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   408
  \item \kwrd{if/elif/else}: branching
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   409
  \item \kwrd{while}: looping
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   410
  \item \kwrd{for}: iterating 
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   411
  \item \kwrd{break, continue}: modify loop 
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   412
  \item \kwrd{pass}: syntactic filler
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   413
  \end{itemize}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   414
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   415
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   416
\subsection{Basic Conditional flow}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   417
\begin{frame}[fragile]
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   418
  \frametitle{\typ{If...elif...else} example}
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   419
  \begin{lstlisting}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   420
x = int(raw_input("Enter an integer:"))
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   421
if x < 0:
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   422
     print 'Be positive!'
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   423
elif x == 0:
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   424
     print 'Zero'
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   425
elif x == 1:
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   426
     print 'Single'
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   427
else:
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   428
     print 'More'
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   429
  \end{lstlisting}
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   430
  \inctime{10}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   431
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   432
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   433
\subsection{Basic Looping}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   434
\begin{frame}[fragile]
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   435
  \frametitle{\typ{while}}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   436
Example: Fibonacci series
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   437
  \begin{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   438
# the sum of two elements
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   439
# defines the next
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   440
a, b = 0, 1
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   441
while b < 10:
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   442
    print b,
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   443
    a, b = b, a + b 
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   444
\end{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   445
\typ{1 1 2 3 5 8}\\  
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   446
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   447
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   448
\begin{frame}[fragile]
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   449
\frametitle{\typ{range()}}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   450
\kwrd{range([start,] stop[, step])}\\
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   451
\begin{itemize}
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   452
  \item range() returns a list of integers
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   453
  \item The \emph{start} and the \emph{step} arguments are optional
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   454
  \item \emph{stop} argument is not included in the list
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   455
\end{itemize}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   456
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   457
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   458
\begin{frame}[fragile]
216
c6704d4a18bd Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 204
diff changeset
   459
  \frametitle{\typ{for} \ldots \typ{range()}}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   460
Example: print squares of first \typ{n} numbers
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   461
  \begin{lstlisting}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   462
In []: for i in range(5):
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   463
 ....:     print i, i * i
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   464
 ....:
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   465
 ....:
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   466
0 0
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   467
1 1
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   468
2 4
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   469
3 9
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   470
4 16
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   471
\end{lstlisting}
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   472
\inctime{5}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   473
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   474
217
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   475
\subsection{Exercises}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   476
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   477
\begin{frame}{Problem set 1: Problem 1.1}
217
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   478
  Write a program that displays all three digit numbers that are equal to the sum of the cubes of their digits. That is, print numbers $abc$ that have the property $abc = a^3 + b^3 + c^3$\\
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   479
\vspace*{0.2in}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   480
\emphbar{These are called $Armstrong$ numbers.}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   481
\end{frame}
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   482
217
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   483
\begin{frame}{Problem 1.2 - Collatz sequence}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   484
\begin{enumerate}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   485
  \item Start with an arbitrary (positive) integer. 
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   486
  \item If the number is even, divide by 2; if the number is odd, multiply by 3 and add 1.
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   487
  \item Repeat the procedure with the new number.
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   488
  \item It appears that for all starting values there is a cycle of 4, 2, 1 at which the procedure loops.
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   489
\end{enumerate}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   490
    Write a program that accepts the starting value and prints out the Collatz sequence.
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   491
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   492
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   493
\begin{frame}[fragile]{Problem 1.3}
217
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   494
  Write a program that prints the following pyramid on the screen. 
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   495
  \begin{lstlisting}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   496
1
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   497
2  2
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   498
3  3  3
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   499
4  4  4  4
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   500
  \end{lstlisting}
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   501
The number of lines must be obtained from the user as input.\\
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   502
\pause
2833f0b51adc Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 216
diff changeset
   503
\emphbar{When can your code fail?}
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   504
\inctime{5}
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   505
\end{frame}
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   506
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   507
\begin{frame}[fragile]
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   508
  \frametitle{What did we learn?}
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   509
  \begin{itemize}
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   510
    \item Basic data types
250
760d5679834e Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 239
diff changeset
   511
    \item Operators
227
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   512
    \item Conditional structures
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   513
    \item Loops
a6705e2dfdc6 Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 217
diff changeset
   514
  \end{itemize}
135
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   515
\end{frame}
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   516
a5da7607ab14 Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   517
\end{document}