day2/session3.tex
author Nishanth Amuluru <nishanth@fossee.in>
Tue, 14 Dec 2010 23:15:36 +0530
branchscipyin2010
changeset 456 a27ccfc118fb
parent 452 f9417abb23a6
permissions -rw-r--r--
removed sslc1.txt from circulate since it is not required
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     2
%Tutorial slides on Python.
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
%
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     4
% Author: FOSSEE 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     5
% Copyright (c) 2009, FOSSEE, IIT Bombay
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     8
\documentclass[14pt,compress]{beamer}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
     9
%\documentclass[draft]{beamer}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    10
%\documentclass[compress,handout]{beamer}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    11
%\usepackage{pgfpages} 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
{
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 220
diff changeset
    18
  \useoutertheme{infolines}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    24
%\usepackage{times}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
\definecolor{darkgreen}{rgb}{0,0.5,0}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
\usepackage{listings}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
\lstset{language=Python,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
    basicstyle=\ttfamily\bfseries,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
    commentstyle=\color{red}\itshape,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
  stringstyle=\color{darkgreen},
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
  showstringspaces=false,
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
  keywordstyle=\color{blue}\bfseries}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    43
% Macros
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
\newcommand{\emphbar}[1]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
{\begin{beamercolorbox}[rounded=true]{emphbar} 
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
      {#1}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
 \end{beamercolorbox}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
\newcounter{time}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
\setcounter{time}{0}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    52
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    53
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
    54
\newcommand{\typ}[1]{\textbf{\texttt{#1}}}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    55
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    56
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    58
%%% This is from Fernando's setup.
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    59
% \usepackage{color}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    60
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    61
% % Use and configure listings package for nicely formatted code
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    62
% \usepackage{listings}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    63
% \lstset{
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    64
%    language=Python,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    65
%    basicstyle=\small\ttfamily,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    66
%    commentstyle=\ttfamily\color{blue},
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    67
%    stringstyle=\ttfamily\color{orange},
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    68
%    showstringspaces=false,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    69
%    breaklines=true,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    70
%    postbreak = \space\dots
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    71
% }
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
% Title page
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
    76
\title[Basic Python]{Python language: Functions, modules and objects}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    77
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    78
\author[FOSSEE Team] {The FOSSEE Group}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    79
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
451
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
    81
\date[] {SciPy.in 2010, Tutorials}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    83
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    87
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    89
%% the beginning of each subsection:
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    90
\AtBeginSubsection[]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    91
{
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    92
  \begin{frame}<beamer>
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    93
    \frametitle{Outline}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    95
  \end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    96
}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    97
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    98
\AtBeginSection[]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    99
{
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   100
  \begin{frame}<beamer>
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   101
    \frametitle{Outline}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   102
    \tableofcontents[currentsection,currentsubsection]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   103
  \end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   104
}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   105
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   106
% If you wish to uncover everything in a step-wise fashion, uncomment
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   107
% the following command: 
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   108
%\beamerdefaultoverlayspecification{<+->}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   109
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   110
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   111
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   113
% DOCUMENT STARTS
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   114
\begin{document}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   115
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   116
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   117
  \titlepage
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   118
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   119
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   120
\begin{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   121
  \frametitle{Outline}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   122
  \tableofcontents
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
  % You might wish to add the option [pausesections]
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   126
\section{Functions}
451
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   127
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   128
\begin{frame}[fragile]
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   129
  \frametitle{Functions}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   130
  \begin{itemize}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   131
    \item \kwrd{def} - keyword to define a function
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   132
    \item Arguments are local to a function
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   133
    \item Functions can return multiple values
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   134
  \end{itemize}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   135
\end{frame}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   136
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   137
\begin{frame}[fragile]
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   138
  \frametitle{Functions: example}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   139
  \begin{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   140
def signum( r ):
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   141
    """returns 0 if r is zero
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   142
    -1 if r is negative
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   143
    +1 if r is positive"""
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   144
    if r < 0:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   145
        return -1
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   146
    elif r > 0:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   147
        return 1
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   148
    else:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   149
        return 0
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   150
  \end{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   151
  \emphbar{Note docstrings}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   152
\end{frame}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   153
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   154
\begin{frame}[fragile]
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   155
  \frametitle {What does this function do?}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   156
  \begin{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   157
def what( n ):
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   158
    if n < 0: n = -n
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   159
    while n > 0:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   160
        if n % 2 == 1:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   161
            return False
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   162
        n /= 10
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   163
    return True
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   164
  \end{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   165
\end{frame} 
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   166
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   167
\begin{frame}[fragile]
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   168
  {What does this function do?}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   169
\begin{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   170
def what( n ):
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   171
    i = 1
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   172
    while i * i < n:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   173
        i += 1
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   174
    return i * i == n, i
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   175
  \end{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   176
\end{frame}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   177
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   178
\begin{frame}[fragile]
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   179
  \frametitle {What does this function do?}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   180
  \begin{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   181
def what( x, n ):
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   182
    if n < 0: 
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   183
       n = -n
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   184
       x = 1.0 / x
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   185
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   186
    z = 1.0
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   187
    while n > 0:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   188
        if n % 2 == 1:
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   189
            z *= x
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   190
        x *= x
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   191
        n /= 2
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   192
    return z
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   193
  \end{lstlisting}
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   194
\end{frame} 
db7b23465572 Fixed day2/session3.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents: 431
diff changeset
   195
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   196
\subsection{Exercises}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   197
\begin{frame}{Problem 3.1}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   198
  Write a function to return the gcd of two numbers.
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   199
\end{frame}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   200
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   201
\begin{frame}{Problem 3.2}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   202
Write a program to print all primitive pythagorean triads (a, b, c) where a, b are in the range 1---100 \\
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   203
A pythagorean triad $(a,b,c)$ has the property $a^2 + b^2 = c^2$.\\By primitive we mean triads that do not `depend' on others. For example, (4,3,5) is a variant of (3,4,5) and hence is not primitive. And (10,24,26) is easily derived from (5,12,13) and is also not primitive.
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   204
\end{frame}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   205
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   206
\begin{frame}{Problem 3.3}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   207
  Write a program that generates a list of all four digit numbers that have all their digits even and are perfect squares.\newline\\\emph{For example, the output should include 6400 but not 8100 (one digit is odd) or 4248 (not a perfect square).}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   208
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   209
% \inctime{15}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   210
\end{frame}
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   211
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   212
\subsection{Default arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   213
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   214
  \frametitle{Functions: default arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   215
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   216
In []: greet = 'hello world'
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   217
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   218
In []: greet.split()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   219
Out[]: ['hello', 'world']
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   220
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   221
In []: line = 'Rossum, Guido, 54, 46, 55'
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   222
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   223
In []: line.split(',')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   224
Out[]: ['Rossum', ' Guido', ' 54',
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   225
                        ' 46', ' 55']
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   226
  \end{lstlisting}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   227
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   228
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   229
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   230
  \frametitle{Functions: default arguments \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   231
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   232
In []: def welcome(greet, name="World"):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   233
  ....     print greet, name
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   234
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   235
In []: welcome("Hello")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   236
Hello World
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   237
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   238
In []: welcome("Hi", "Guido")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   239
Hi Guido
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   240
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   241
\end{frame} 
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   242
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   243
\subsection{Keyword arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   244
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   245
  \frametitle{Functions: Keyword arguments}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   246
We have seen the following
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   247
\begin{lstlisting}
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   248
legend(['sin(2y)'], loc = 'center')
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   249
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   250
plot(y, sin(y), 'g', linewidth = 2)
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   251
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   252
annotate('local max', xy = (1.5, 1))
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   253
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 384
diff changeset
   254
pie(science.values(), 
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   255
            labels = science.keys())
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   256
  \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   257
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   258
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   259
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   260
  \frametitle{Functions: keyword arguments \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   261
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   262
In []: def welcome(greet, name="World"):
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   263
  ....     print greet, name
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   264
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   265
In []: welcome("Hello", "James")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   266
Hello James
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   267
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   268
In []: welcome("Hi", name="Guido")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   269
Hi Guido
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   270
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   271
In []: welcome(name="Guido", greet="Hey")
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   272
Hey Guido
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   273
  \end{lstlisting}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   274
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   275
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   276
\subsection{Built-in functions}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   277
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   278
  {Before writing a function}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   279
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   280
      \item Variety of built-in functions are available
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   281
      \item \typ{abs, any, all, len, max, min}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   282
      \item \typ{pow, range, sum, type}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   283
      \item Refer here:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   284
          \url{http://docs.python.org/library/functions.html}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   285
  \end{itemize}
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   286
%  \inctime{10} 
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   287
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   289
\section{Modules}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   290
\begin{frame}[fragile]
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   291
  \frametitle{\typ{from} \ldots \typ{import} magic}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   292
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   293
from scipy.integrate import odeint
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   294
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   295
from scipy.optimize import fsolve
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   296
  \end{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   297
\emphbar{Above statements import a function to our namespace}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   298
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   299
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   300
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   301
  \frametitle{Running scripts from command line}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   302
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   303
  \begin{itemize}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   304
    \item Fire up a terminal
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   305
    \item python four\_plot.py
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   306
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   307
  \pause
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   308
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   309
Traceback (most recent call last):
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   310
  File "four_plot.py", line 1, in <module>
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   311
    x = linspace(-5*pi, 5*pi, 500)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   312
NameError: name 'linspace' is not defined
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   313
  \end{lstlisting}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   314
\end{frame}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   315
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   316
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   317
  \frametitle{Remedy \ldots}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   318
  \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   319
from scipy import *
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   320
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   321
\alert{Now run python four\_plot.py again}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   322
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   323
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   324
\begin{frame}[fragile]
380
669b72283b55 Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   325
  \frametitle{Now what?}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   326
  \begin{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   327
Traceback (most recent call last):
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   328
  File "four_plot.py", line 1, in <module>
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   329
    x = plot(x, x, 'b')
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   330
NameError: name 'plot' is not defined
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   331
  \end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   332
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   333
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   334
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   335
  \frametitle{Remedy \ldots}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   336
  \begin{lstlisting}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   337
from pylab import *
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   338
  \end{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   339
\alert{Now run python four\_plot.py again!!}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   340
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   341
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   342
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   343
  \frametitle{Modules}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   344
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   345
    \item The \kwrd{import} keyword ``loads'' a module
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   346
    \item One can also use:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   347
      \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   348
In []: from scipy import *
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   349
In []: from scipy import linspace
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   350
      \end{lstlisting}    
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   351
    \item What is the difference?
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   352
    \item \alert{Use the former only in interactive mode}
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   353
    \end{itemize}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   354
\end{frame}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   355
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   356
\begin{frame}[fragile]
429
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   357
  \frametitle{IPython namespace}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   358
  \begin{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   359
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   360
In [4]: whos
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   361
Interactive namespace is empty.
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   362
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   363
  \end{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   364
\end{frame}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   365
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   366
\begin{frame}[fragile]
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   367
  \frametitle{IPython namespace}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   368
  \begin{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   369
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   370
In [5]: from numpy import *
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   371
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   372
In [6]: whos
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   373
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   374
  \end{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   375
\end{frame}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   376
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   377
\begin{frame}[fragile]
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   378
  \frametitle{Package hierarchies}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   379
  \begin{lstlisting}
297
a835affb1447 Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 288
diff changeset
   380
from scipy.integrate import odeint
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 256
diff changeset
   381
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   382
from scipy.optimize import fsolve
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   383
  \end{lstlisting}
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   384
\end{frame}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   385
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   386
\begin{frame}[fragile]
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   387
  \frametitle{\typ{from} \ldots \typ{import} - conventional way!}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   388
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   389
  \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   390
from scipy import linspace, pi, sin
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   391
from pylab import plot, legend, annotate
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   392
from pylab import xlim, ylim
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   393
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   394
x = linspace(-5*pi, 5*pi, 500)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   395
plot(x, x, 'b')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   396
plot(x, -x, 'b')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   397
plot(x, sin(x), 'g', linewidth=2)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   398
plot(x, x*sin(x), 'r', linewidth=3)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   399
legend(['x', '-x', 'sin(x)', 'xsin(x)'])
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   400
annotate('origin', xy = (0, 0))
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   401
xlim(-5*pi, 5*pi)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   402
ylim(-5*pi, 5*pi)
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   403
  \end{lstlisting}
171
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   404
\end{frame}
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   405
29c0c504750c Added some changes suggested during the review.
Shantanu <shantanu@fossee.in>
parents: 154
diff changeset
   406
\begin{frame}[fragile]
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   407
  \frametitle{\typ{from} \ldots \typ{import} - conventional way!}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   408
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   409
  \begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   410
import scipy
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   411
import pylab
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   412
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   413
x = scipy.linspace(-5*scipy.pi, 5*scipy.pi, 500)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   414
pylab.plot(x, x, 'b')
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   415
pylab.plot(x, -x, 'b')
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   416
pylab.plot(x, scipy.sin(x), 'g', linewidth=2)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   417
pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3)
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   418
pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   419
pylab.annotate('origin', xy = (0, 0))
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   420
pylab.xlim(-5*scipy.pi, 5*scipy.pi)
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 351
diff changeset
   421
pylab.ylim(-5*scipy.pi, 5*scipy.pi)
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   422
  \end{lstlisting}
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   423
\end{frame}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents: 215
diff changeset
   424
429
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   425
\begin{frame}[fragile]
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   426
  \frametitle{\typ{import} - the community convention}
429
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   427
  \begin{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   428
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   429
import numpy as np
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   430
np.linspace(-5 * np.pi, 5 * np.pi, 500)
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   431
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   432
import scipy as sp
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   433
sp.linspace(-5 * sp.pi, 5 * sp.pi, 500)
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   434
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   435
  \end{lstlisting}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   436
\end{frame}
58a2d1766197 DOC: Add a few slides on namespaces and imports.
Christopher Burns <chris.d.burns@gmail.com>
parents: 389
diff changeset
   437
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents: 215
diff changeset
   438
\begin{frame}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   439
  \frametitle{Modules: Standard library}
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   440
  \begin{itemize}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   441
  \item Very powerful, ``Batteries included''
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   442
  \item Some standard modules:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   443
    \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   444
    \item Math: \typ{math}, \typ{random}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   445
    \item Internet access: \typ{urllib2}, \typ{smtplib}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   446
    \item System, Command line arguments: \typ{sys}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   447
    \item Operating system interface: \typ{os}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   448
    \item Regular expressions: \typ{re}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   449
    \item Compression: \typ{gzip}, \typ{zipfile}, and \typ{tarfile}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   450
    \item And a whole lot more!
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   451
    \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   452
  \item Check out the Python Library reference:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   453
    \url{http://docs.python.org/library/}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   454
  \end{itemize}
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   455
% \inctime{5}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   456
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   457
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   458
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   459
  \frametitle{Modules of special interest}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   460
  \begin{description}[matplotlibfor2d]
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   461
    \item[\typ{pylab}] Easy, interactive, 2D plotting
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   462
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   463
    \item[\typ{scipy}] arrays, statistics, optimization, integration, linear
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   464
            algebra, Fourier transforms, signal and image processing,
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   465
            genetic algorithms, ODE solvers, special functions, and more
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   466
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   467
    \item[\typ{mayavi}] Easy, interactive, 3D plotting
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   468
  \end{description}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   469
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   470
431
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   471
\begin{frame}[fragile]
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   472
  \frametitle{From which module?}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   473
  
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   474
This plot function in pylab is cool, 
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   475
from where do I import it to include it in 
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   476
my\_nifty\_module.py?
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   477
  
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   478
\end{frame}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   479
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   480
\begin{frame}[fragile]
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   481
  \frametitle{From which module?}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   482
  \begin{lstlisting}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   483
   
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   484
In [15]: plot.__module__
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   485
Out[15]: 'matplotlib.pyplot'
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   486
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   487
from matplotlib.pyplot import plot
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   488
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   489
  \end{lstlisting}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   490
\end{frame}
9126059d6b37 DOC: Add slide about __module__ attribute.
Christopher Burns <chris.d.burns@gmail.com>
parents: 429
diff changeset
   491
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   492
\section{Objects}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   493
\begin{frame}{Everything is an Object!}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   494
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   495
    \item \typ{int}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   496
    \item \typ{float}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   497
    \item \typ{str}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   498
    \item \typ{list}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   499
    \item \typ{tuple}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   500
    \item \typ{string}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   501
    \item \typ{dictionary}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   502
    \item \typ{function}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   503
    \item User defined class is also an object!
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   504
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   505
\end {frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   506
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   507
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   508
\frametitle{Using Objects}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   509
  \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   510
    \item Creating Objects
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   511
    \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   512
      \item Initialization
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   513
    \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   514
    \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   515
In []: a = str()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   516
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   517
In []: b = "Hello World"
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   518
    \end{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   519
    \item Object Manipulation
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   520
    \begin{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   521
      \item Object methods
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   522
      \item ``.'' operator
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   523
    \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   524
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   525
In []: "Hello World".split()
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   526
Out[]: ['Hello', 'World']
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   527
    \end{lstlisting}
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   528
  \end{itemize}
219
f6725f6bee41 Session 4, Debugging and Testing.
Shantanu <shantanu@fossee.in>
parents: 215
diff changeset
   529
\end{frame}
220
15306dad3b81 Corrections to day1 Session1, day2 Session 3 and 4.
Shantanu <shantanu@fossee.in>
parents: 219
diff changeset
   530
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   531
\begin{frame}[fragile]
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   532
  \frametitle{Objects provide consistency}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   533
  \small
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   534
  \begin{lstlisting}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   535
for element in (1, 2, 3):
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   536
    print element
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   537
for key in {'one':1, 'two':2}:
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   538
    print key
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   539
for char in "123":
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   540
    print char
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   541
for line in open("myfile.txt"):
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   542
    print line
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   543
for line in urllib2.urlopen('http://site.com'):
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   544
    print line
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   545
  \end{lstlisting}
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   546
%  \inctime{10}
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   547
\end{frame}
154
66b117b7edc7 Added slides for 3D data visualization session 3 day 2.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   548
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   549
\begin{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   550
  \frametitle{What did we learn?}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   551
  \begin{itemize}
452
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   552
    \item Functions: Definition
f9417abb23a6 Moved exercises and other minor changes in day2/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 451
diff changeset
   553
    \item Functions: Docstrings
288
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   554
    \item Functions: Default and Keyword arguments
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   555
    \item Modules
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   556
    \item Objects
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   557
  \end{itemize}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   558
\end{frame}
c4e25269a86c Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 263
diff changeset
   559
330
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 300
diff changeset
   560
\end{document}
344
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   561
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   562
%% Questions for Quiz %%
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   563
%% ------------------ %%
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   564
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   565
\begin{frame}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   566
    \frametitle{\incqno}
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   567
  How many items can a function return?
19754ed6050f Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   568
\end{frame}