author | Santosh G. Vattam <vattam.santosh@gmail.com> |
Wed, 21 Apr 2010 13:47:36 +0530 | |
changeset 384 | 9f9fddf7e37c |
parent 380 | 669b72283b55 |
child 385 | c70118cdde66 |
permissions | -rw-r--r-- |
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 |
% |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
4 |
% Author: FOSSEE |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
5 |
% Copyright (c) 2009, FOSSEE, IIT Bombay |
135
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 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
54 |
\newcommand{\typ}[1]{\lstinline{#1}} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
55 |
|
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
56 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
57 |
\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
|
58 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
59 |
%%% 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
|
60 |
% \usepackage{color} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
61 |
% \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
|
62 |
% % 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
|
63 |
% \usepackage{listings} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
64 |
% \lstset{ |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
65 |
% language=Python, |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
66 |
% basicstyle=\small\ttfamily, |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
67 |
% 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
|
68 |
% 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
|
69 |
% showstringspaces=false, |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
70 |
% breaklines=true, |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
71 |
% postbreak = \space\dots |
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 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
76 |
% Title page |
250
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
77 |
\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
|
78 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
79 |
\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
|
80 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
81 |
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
384
9f9fddf7e37c
MNIT Jaipur changes.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
380
diff
changeset
|
82 |
\date[] {03 April, 2010\\Day 2, Session 1} |
135
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 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
85 |
%\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
|
86 |
%\logo{\pgfuseimage{iitmlogo}} |
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 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
89 |
%% 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
|
90 |
%% 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
|
91 |
\AtBeginSubsection[] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
92 |
{ |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
93 |
\begin{frame}<beamer> |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
94 |
\frametitle{Outline} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
95 |
\tableofcontents[currentsection,currentsubsection] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
96 |
\end{frame} |
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 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
99 |
\AtBeginSection[] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
100 |
{ |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
101 |
\begin{frame}<beamer> |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
102 |
\frametitle{Outline} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
103 |
\tableofcontents[currentsection,currentsubsection] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
104 |
\end{frame} |
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 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
107 |
% 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
|
108 |
% the following command: |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
109 |
%\beamerdefaultoverlayspecification{<+->} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
110 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
111 |
%\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
|
112 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
113 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
114 |
% DOCUMENT STARTS |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
115 |
\begin{document} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
116 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
117 |
\begin{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
118 |
\titlepage |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
119 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
120 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
121 |
\begin{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
122 |
\frametitle{Outline} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
123 |
\tableofcontents |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
124 |
% 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
|
125 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
126 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
127 |
\section{Data types} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
128 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
129 |
\begin{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
130 |
\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
|
131 |
\begin{itemize} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
132 |
\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
|
133 |
\item Strings |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
134 |
\item Booleans |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
135 |
\end{itemize} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
136 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
137 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
138 |
\subsection{Numbers} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
139 |
\begin{frame}[fragile] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
140 |
\frametitle{Numbers} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
141 |
\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
|
142 |
\item \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
|
143 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
144 |
In []: a = 13 |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
145 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
146 |
In []: b = 99999999999999999999 |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
147 |
\end{lstlisting} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
148 |
\item \kwrd{float} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
149 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
150 |
In []: p = 3.141592 |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
151 |
\end{lstlisting} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
152 |
\end{itemize} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
153 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
154 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
155 |
\begin{frame}[fragile] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
156 |
\frametitle{Complex numbers} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
157 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
158 |
In []: c = 3+4j |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
159 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
160 |
In []: abs(c) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
161 |
Out[]: 5.0 |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
162 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
163 |
In []: c.imag |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
164 |
Out[]: 4.0 |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
165 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
166 |
In []: c.real |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
167 |
Out[]: 3.0 |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
168 |
\end{lstlisting} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
169 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
170 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
171 |
\subsection{Booleans} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
172 |
\begin{frame}[fragile] |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
173 |
\frametitle{Booleans} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
174 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
175 |
In []: t = True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
176 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
177 |
In []: f = not t |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
178 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
179 |
In []: f or t |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
180 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
181 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
182 |
In []: f and t |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
183 |
Out[]: False |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
184 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
185 |
\inctime{5} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
186 |
\end{frame} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
187 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
188 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
189 |
\frametitle{( ) for precedence} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
190 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
191 |
In []: a = False |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
192 |
In []: b = True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
193 |
In []: c = True |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
194 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
195 |
In []: (a and b) or c |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
196 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
197 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
198 |
In []: a and (b or c) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
199 |
Out[]: False |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
200 |
\end{lstlisting} |
227
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
201 |
\inctime{5} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
202 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
203 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
204 |
\subsection{Strings} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
205 |
|
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
206 |
\begin{frame}[fragile] |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
207 |
\frametitle{Strings} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
208 |
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
|
209 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
210 |
In []: w = "hello" |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
211 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
212 |
In []: print w[0] + w[2] + w[-1] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
213 |
Out[]: hlo |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
214 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
215 |
In []: len(w) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
216 |
Out[]: 5 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
217 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
218 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
219 |
|
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
220 |
\begin{frame}[fragile] |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
221 |
\frametitle{Strings \ldots} |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
222 |
\emphbar{Strings are immutable} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
223 |
\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
|
224 |
In []: w[0] = 'H' |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
225 |
\end{lstlisting} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
226 |
\pause |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
227 |
\begin{lstlisting} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
228 |
-------------------------------------------- |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
229 |
TypeError Traceback (most recent call last) |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
230 |
|
384
9f9fddf7e37c
MNIT Jaipur changes.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
380
diff
changeset
|
231 |
<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
|
232 |
|
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
233 |
TypeError: 'str' object does not |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
234 |
support item assignment |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
235 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
236 |
\end{frame} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
237 |
|
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
238 |
\begin{frame}[fragile] |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
239 |
\frametitle{String methods} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
240 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
241 |
In []: a = 'Hello World' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
242 |
In []: a.startswith('Hell') |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
243 |
Out[]: True |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
244 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
245 |
In []: a.endswith('ld') |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
246 |
Out[]: True |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
247 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
248 |
In []: a.upper() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
249 |
Out[]: 'HELLO WORLD' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
250 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
251 |
In []: a.lower() |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
252 |
Out[]: 'hello world' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
253 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
254 |
\end{frame} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
255 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
256 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
257 |
\frametitle{A bit about IPython} |
366
ec4cb3ba7f09
Changed all sessions based on tot session.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
359
diff
changeset
|
258 |
Recall, we showed a few features of IPython, here is one more: |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
259 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
260 |
\item IPython provides better help |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
261 |
\item object.function? |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
262 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
263 |
In []: a = 'Hello World' |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
264 |
In []: a.lower? |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
265 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
266 |
\end{itemize} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
267 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
268 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
269 |
\begin{frame}[fragile] |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
270 |
\frametitle{Still with strings} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
271 |
\begin{itemize} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
272 |
\item We saw split() yesterday |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
273 |
\item join() is the opposite of split() |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
274 |
\end{itemize} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
275 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
276 |
In []: ''.join(['a', 'b', 'c']) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
277 |
Out[]: 'abc' |
373
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
278 |
|
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
279 |
In []: ', '.join(['a', 'b', 'c']) |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
280 |
Out[]: 'a, b, c' |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
281 |
\end{lstlisting} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
282 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
283 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
284 |
\begin{frame}[fragile] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
285 |
\frametitle{String formatting} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
286 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
287 |
In []: x, y = 1, 1.234 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
288 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
289 |
In []: 'x is %s, y is %s' %(x, y) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
290 |
Out[]: '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
|
291 |
\end{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
292 |
\begin{itemize} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
293 |
\item \emph{\%d}, \emph{\%f} etc. available |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
294 |
\end{itemize} |
227
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
295 |
\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
|
296 |
\inctime{10} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
297 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
298 |
|
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
299 |
\section{Operators} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
300 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
301 |
\frametitle{Arithmetic operators} |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
302 |
\small |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
303 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
304 |
In []: 1786 % 12 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
305 |
Out[]: 10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
306 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
307 |
In []: 45 % 2 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
308 |
Out[]: 1 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
309 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
310 |
In []: 864675 % 10 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
311 |
Out[]: 5 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
312 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
313 |
In []: 3124 * 126789 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
314 |
Out[]: 396088836 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
315 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
316 |
In []: big = 1234567891234567890 ** 3 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
317 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
318 |
In []: verybig = big * big * big * big |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
319 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
320 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
321 |
|
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
322 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
323 |
\frametitle{Arithmetic operators} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
324 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
325 |
In []: 17 / 2 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
326 |
Out[]: 8 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
327 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
328 |
In []: 17 / 2.0 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
329 |
Out[]: 8.5 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
330 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
331 |
In []: 17.0 / 2 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
332 |
Out[]: 8.5 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
333 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
334 |
In []: 17.0 / 8.5 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
335 |
Out[]: 2.0 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
336 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
337 |
\end{frame} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
338 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
339 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
340 |
\frametitle{Arithmetic operators} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
341 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
342 |
In []: a = 7546 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
343 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
344 |
In []: a += 1 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
345 |
In []: a |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
346 |
Out[]: 7547 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
347 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
348 |
In []: a -= 5 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
349 |
In []: a |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
350 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
351 |
In []: a *= 2 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
352 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
353 |
In []: a /= 5 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
354 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
355 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
356 |
|
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
357 |
\begin{frame}[fragile] |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
358 |
\frametitle{String operations} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
359 |
\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
|
360 |
In []: s = 'Hello' |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
361 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
362 |
In []: p = 'World' |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
363 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
364 |
In []: s + p |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
365 |
Out[]: 'HelloWorld' |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
366 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
367 |
In []: s * 4 |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
368 |
Out[]: 'HelloHelloHelloHello' |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
369 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
370 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
371 |
|
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
372 |
\begin{frame}[fragile] |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
373 |
\frametitle{String operations \ldots} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
374 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
375 |
In []: s * s |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
376 |
\end{lstlisting} |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
377 |
\pause |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
378 |
\begin{lstlisting} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
379 |
-------------------------------------------- |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
380 |
TypeError Traceback (most recent call last) |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
381 |
|
380
669b72283b55
Updated after Day 2 at GRDCS
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
382 |
<ipython console> in <module>() |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
383 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
384 |
TypeError: can`t multiply sequence by |
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
385 |
non-int of type `str` |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
386 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
387 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
388 |
|
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
389 |
\begin{frame}[fragile] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
390 |
\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
|
391 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
392 |
In []: p, z, n = 1, 0, -1 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
393 |
In []: p == n |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
394 |
Out[]: False |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
395 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
396 |
In []: p >= n |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
397 |
Out[]: True |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
398 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
399 |
In []: n < z < p |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
400 |
Out[]: True |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
401 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
402 |
In []: p + n != z |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
403 |
Out[]: False |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
404 |
\end{lstlisting} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
405 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
406 |
|
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
407 |
\begin{frame}[fragile] |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
408 |
\frametitle{Built-ins} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
409 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
410 |
In []: int(17 / 2.0) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
411 |
Out[]: 8 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
412 |
|
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
413 |
In []: float(17 / 2) |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
414 |
Out[]: 8.0 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
415 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
416 |
In []: str(17 / 2.0) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
417 |
Out[]: '8.5' |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
418 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
419 |
In []: round( 7.5 ) |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
420 |
Out[]: 8.0 |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
421 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
422 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
423 |
|
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
424 |
\begin{frame}[fragile] |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
425 |
\frametitle{Odds and ends} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
426 |
\begin{itemize} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
427 |
\item Case sensitive |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
428 |
\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
|
429 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
430 |
In []: a = 1 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
431 |
In []: a = 1.1 |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
432 |
In []: a = "Now I am a string!" |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
433 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
434 |
\item Comments: |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
435 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
436 |
In []: a = 1 # In-line comments |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
437 |
In []: # A comment line. |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
438 |
In []: a = "# Not a comment!" |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
439 |
\end{lstlisting} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
440 |
\end{itemize} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
441 |
\inctime{15} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
442 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
443 |
|
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
444 |
\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
|
445 |
\begin{frame}[fragile] |
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
446 |
\frametitle{Simple IO: Console Input} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
447 |
\small |
250
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
448 |
\begin{itemize} |
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
449 |
\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
|
450 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
451 |
In []: a = raw_input() |
250
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
452 |
5 |
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
453 |
|
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
454 |
In []: a |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
455 |
Out[]: '5' |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
456 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
457 |
In []: a = raw_input('Enter a value: ') |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
458 |
Enter a value: 5 |
250
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
459 |
\end{lstlisting} |
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
460 |
\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
|
461 |
\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
|
462 |
\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
|
463 |
\end{itemize} |
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
464 |
\end{frame} |
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
465 |
|
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
466 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
467 |
\frametitle{Simple IO: Console output} |
250
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
468 |
\begin{itemize} |
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
469 |
\item \typ{print} is straight forward |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
470 |
\item Put the following code snippet in a file \typ{hello1.py} |
250
760d5679834e
Fixed typos and hanging words in Session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
239
diff
changeset
|
471 |
\end{itemize} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
472 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
473 |
print "Hello" |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
474 |
print "World" |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
475 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
476 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
477 |
In []: %run -i hello1.py |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
478 |
Hello |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
479 |
World |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
480 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
481 |
\end{frame} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
482 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
483 |
\begin{frame}[fragile] |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
484 |
\frametitle{Simple IO: Console output \ldots} |
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
485 |
Put the following code snippet in a file \typ{hello2.py} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
486 |
\begin{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
487 |
print "Hello", |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
488 |
print "World" |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
489 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
490 |
|
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
491 |
In []: %run -i hello2.py |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
492 |
Hello World |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
493 |
\end{lstlisting} |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
494 |
|
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
495 |
\emphbar{Note the distinction between \typ{print x} and \typ{print x,}} |
216
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
496 |
\end{frame} |
c6704d4a18bd
Removed multiplication of list with * operator.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
204
diff
changeset
|
497 |
|
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
498 |
\section{Control flow} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
499 |
\begin{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
500 |
\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
|
501 |
\begin{itemize} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
502 |
\item \kwrd{if/elif/else}: branching |
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
503 |
\item \kwrd{C if X else D}: Ternary conditional operator |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
504 |
\item \kwrd{while}: looping |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
505 |
\item \kwrd{for}: iterating |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
506 |
\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
|
507 |
\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
|
508 |
\end{itemize} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
509 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
510 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
511 |
\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
|
512 |
\begin{frame}[fragile] |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
513 |
\frametitle{\typ{If...elif...else} example} |
373
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
514 |
Type the following code in an editor \& save as \alert{ladder.py} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
515 |
\small |
227
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
516 |
\begin{lstlisting} |
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
517 |
x = int(raw_input("Enter an integer:")) |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
518 |
if x < 0: |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
519 |
print 'Be positive!' |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
520 |
elif x == 0: |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
521 |
print 'Zero' |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
522 |
elif x == 1: |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
523 |
print 'Single' |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
524 |
else: |
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
525 |
print 'More' |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
526 |
|
227
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
527 |
\end{lstlisting} |
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
528 |
\inctime{10} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
529 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
530 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
531 |
\begin{frame}[fragile] |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
532 |
\frametitle{Ternary conditional operator} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
533 |
\begin{lstlisting} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
534 |
... |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
535 |
a = raw_input('Enter number(Q to quit):') |
297
a835affb1447
Added final changes to all day 2 slides for Calicut workshop.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
288
diff
changeset
|
536 |
num = int(a) if a != 'Q' else 0 |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
537 |
... |
217
2833f0b51adc
Completed day 2 Session 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
216
diff
changeset
|
538 |
\end{lstlisting} |
227
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
539 |
\end{frame} |
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
540 |
|
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
541 |
\begin{frame}[fragile] |
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
542 |
\frametitle{What did we learn?} |
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
543 |
\begin{itemize} |
288
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
544 |
\item Data types: int, float, complex, boolean, string |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
545 |
\item Operators: +, -, *, /, \%, **, +=, -=, *=, /=, >, <, <=, >=, ==, !=, a < b < c |
c4e25269a86c
Reorganized slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
250
diff
changeset
|
546 |
\item Simple IO: \kwrd{raw\_input} and \kwrd{print} |
359
cb17c87b090e
Fixed errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
344
diff
changeset
|
547 |
\item Conditional structures: \kwrd{if/elif/else},\\ \kwrd{C if X else D} |
227
a6705e2dfdc6
Complete session 1 day 2.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
217
diff
changeset
|
548 |
\end{itemize} |
135
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
549 |
\end{frame} |
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
550 |
|
a5da7607ab14
Added Session 1, Day 2 - "Formal approach to Python" slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
551 |
\end{document} |
344
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
552 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
553 |
%% Questions for Quiz %% |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
554 |
%% ------------------ %% |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
555 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
556 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
557 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
558 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
559 |
What is the largest integer value that can be represented natively by Python? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
560 |
\end{frame} |
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 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
563 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
564 |
What is the result of 17.0 / 2? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
565 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
566 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
567 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
568 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
569 |
Which of the following is not a type in Python? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
570 |
\begin{enumerate} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
571 |
\item int |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
572 |
\item float |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
573 |
\item char |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
574 |
\item string |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
575 |
\end{enumerate} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
576 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
577 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
578 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
579 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
580 |
How do you create a complex number with real part 2 and imaginary part |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
581 |
0.5. |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
582 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
583 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
584 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
585 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
586 |
What is the difference between \kwrd{print} \emph{x} and \kwrd{print} \emph{x,} ? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
587 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
588 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
589 |
\begin{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
590 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
591 |
What does '*' * 40 produce? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
592 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
593 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
594 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
595 |
\frametitle{\incqno } |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
596 |
What is the output of: |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
597 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
598 |
In []: ', '.join(['a', 'b', 'c']) |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
599 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
600 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
601 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
602 |
|
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
603 |
\begin{frame}[fragile] |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
604 |
\frametitle{\incqno} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
605 |
\begin{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
606 |
In []: 47 % 3 |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
607 |
\end{lstlisting} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
608 |
What is the output? |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
609 |
\end{frame} |
19754ed6050f
Moved all day2 quiz questions to end of day2-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
610 |