Merged heads.
--- a/accessing-pieces-arrays/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/accessing-pieces-arrays/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -298,8 +298,7 @@
Following is an exercise that you must do.
-%%5%% Pause the video here, and obtain the square in the center
-of the image.
+%%5%% Obtain the square in the center of the image.
Following is an exercise that you must do.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/accessing-pieces-arrays/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,123 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Accessing parts of arrays
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Manipulating one and multi dimensional arrays
+ - Access and change individual elements
+ - Access and change rows and columns
+ - Slicing and striding on arrays to access chunks
+ - Read images into arrays and manipulations
+* Sample Arrays
+ #+begin_src python
+ In []: A = array([12, 23, 34, 45, 56])
+
+ In []: C = array([[11, 12, 13, 14, 15],
+ [21, 22, 23, 24, 25],
+ [31, 32, 33, 34, 35],
+ [41, 42, 43, 44, 45],
+ [51, 52, 53, 54, 55]])
+
+ #+end_src
+* Question 1
+ Change the last column of ~C~ to zeroes.
+* Solution 1
+ #+begin_src python
+ In []: C[:, -1] = 0
+ #+end_src
+* Question 2
+ Change ~A~ to ~[11, 12, 13, 14, 15]~.
+* Solution 2
+ #+begin_src python
+ In []: A[:] = [11, 12, 13, 14, 15]
+ #+end_src
+* squares.png
+ #+begin_latex
+ \begin{center}
+ \includegraphics[scale=0.6]{squares}
+ \end{center}
+ #+end_latex
+* Question 3
+ - obtain ~[22, 23]~ from ~C~.
+ - obtain ~[11, 21, 31, 41]~ from ~C~.
+ - obtain ~[21, 31, 41, 0]~.
+* Solution 3
+ #+begin_src python
+ In []: C[1, 1:3]
+ In []: C[0:4, 0]
+ In []: C[1:5, 0]
+ #+end_src
+* Question 4
+ Obtain ~[[23, 24], [33, -34]]~ from ~C~
+* Solution 4
+ #+begin_src python
+ In []: C[1:3, 2:4]
+ #+end_src
+* Question 5
+ Obtain the square in the center of the image
+* Solution 5
+ #+begin_src python
+ In []: imshow(I[75:225, 75:225])
+ #+end_src
+* Question 6
+ Obtain the following
+ #+begin_src python
+ [[12, 0], [42, 0]]
+ [[12, 13, 14], [0, 0, 0]]
+ #+end_src
+
+* Solution 6
+ #+begin_src python
+ In []: C[::3, 1::3]
+ In []: C[::4, 1:4]
+ #+end_src
+* Summary
+ You should now be able to --
+ - Manipulate 1D \& Multi dimensional arrays
+ - Access and change individual elements
+ - Access and change rows and columns
+ - Slice and stride on arrays
+ - Read images into arrays and manipulate them.
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/accessing-pieces-arrays/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/accessing-pieces-arrays/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,203 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 18:48
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Accessing parts of arrays}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Manipulating one and multi dimensional arrays
+\item Access and change individual elements
+\item Access and change rows and columns
+\item Slicing and striding on arrays to access chunks
+\item Read images into arrays and manipulations
+\end{itemize}
\end{frame}
+\begin{frame}[fragile]
+\frametitle{Sample Arrays}
+\label{sec-2}
+\lstset{language=Python}
+\begin{lstlisting}
+In []: A = array([12, 23, 34, 45, 56])
+
+In []: C = array([[11, 12, 13, 14, 15],
+ [21, 22, 23, 24, 25],
+ [31, 32, 33, 34, 35],
+ [41, 42, 43, 44, 45],
+ [51, 52, 53, 54, 55]])
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-3}
+
+ Change the last column of \texttt{C} to zeroes.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 1}
+\label{sec-4}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: C[:, -1] = 0
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-5}
+
+ Change \texttt{A} to \texttt{[11, 12, 13, 14, 15]}.
\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 2}
+\label{sec-6}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: A[:] = [11, 12, 13, 14, 15]
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{squares.png}
+\label{sec-7}
+
+ \begin{center}
+ \includegraphics[scale=0.6]{squares}
+ \end{center}
+\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-8}
+
+\begin{itemize}
+\item obtain \texttt{[22, 23]} from \texttt{C}.
+\item obtain \texttt{[11, 21, 31, 41]} from \texttt{C}.
+\item obtain \texttt{[21, 31, 41, 0]}.
+\end{itemize}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 3}
+\label{sec-9}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+In []: C[1, 1:3]
+In []: C[0:4, 0]
+In []: C[1:5, 0]
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 4}
+\label{sec-10}
+
+ Obtain \texttt{[[23, 24], [33, -34]]} from \texttt{C}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 4}
+\label{sec-11}
+\lstset{language=Python}
+\begin{lstlisting}
+In []: C[1:3, 2:4]
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 5}
+\label{sec-12}
+
+ Obtain the square in the center of the image
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 5}
+\label{sec-13}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: imshow(I[75:225, 75:225])
+\end{lstlisting}
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Question 6}
+\label{sec-14}
+
+ Obtain the following
+\lstset{language=Python}
+\begin{lstlisting}
+[[12, 0], [42, 0]]
+[[12, 13, 14], [0, 0, 0]]
+\end{lstlisting}
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 6}
+\label{sec-15}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: C[::3, 1::3]
+In []: C[::4, 1:4]
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-16}
+
+ You should now be able to --
+\begin{itemize}
+\item Manipulate 1D \& Multi dimensional arrays
+
+\begin{itemize}
+\item Access and change individual elements
+\item Access and change rows and columns
+\item Slice and stride on arrays
+\end{itemize}
+
+\item Read images into arrays and manipulate them.
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-17}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/additional_ipython/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/additional_ipython/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -6,6 +6,14 @@
C -
D -
+.. By the end of this tutorial you will be able to
+
+.. #. Retrieve your ipython history
+.. #. View a part of the history
+.. #. Save a part of your history to a file.
+.. #. Run a script from within ipython
+
+
.. Prerequisites
.. -------------
@@ -81,8 +89,8 @@
{{{ Pause here and try out the following exercises }}}
-%% 1 %% Read through the %hist documenatation and find out how can we list all
- the commands between 5 and 10
+%% 1 %% Read through the documentation of %hist and find out how to
+ list all the commands between 5 and 10
{{{ continue from paused state }}}
@@ -128,7 +136,7 @@
{{{ Pause here and try out the following exercises }}}
-%% 2 %% change the label on y-axis to "y" and save the lines of code
+%% 2 %% Change the label on y-axis to "y" and save the lines of code
accordingly
{{{ continue from paused state }}}
@@ -210,5 +218,5 @@
This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
Hope you have enjoyed and found it useful.
-Thankyou
+Thank you!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/additional_ipython/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,90 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER:\usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Additional Features of =ipython=
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ + Retrieving ipython history
+ + Viewing a part of the history
+ + Saving (relevant) parts of the history to a file
+ + Running a script from within ipython
+* Question 1
+ Read through the documentation of ~%hist~ and find out how to list
+ all the commands between 5 and 10
+* Solution 1
+ #+begin_src python
+ In []: %hist 5 10
+ #+end_src
+* Question 2
+ Change the label on y-axis to "y" and save the lines of code
+ accordingly
+* Solution 2
+ #+begin_src python
+ In []: ylabel("y")
+ In []: %save /home/fossee/example_plot.py 1 3-6 10
+ #+end_src
+* Question 3
+ Use =%hist= and =%save= and create a script that has show in it and
+ run it to produce and show the plot.
+
+* Solution 3
+ #+begin_src python
+ In []: %hist 20
+
+ In []: %save /home/fossee/show_included.py 1 3-6 8 10 13
+ In []: %run -i /home/fossee/show_included.py
+ #+end_src
+* Question 4
+ Run the script without using the -i option. Do you find any
+ difference?
+* Solution 4
+ We see that it raises ~NameError~ saying the name ~linspace~ is not
+ found.
+* Summary
+ + Retreiving history using =%hist= command
+ + Vieweing only a part of history by passing an argument to %hist
+ + Saving the required lines of code in required order using %save
+ + Using %run -i command to run the saved script
+
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/additional_ipython/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/additional_ipython/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,138 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 17:30
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Additional Features of \texttt{ipython}}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Retrieving ipython history
+\item Viewing a part of the history
+\item Saving (relevant) parts of the history to a file
+\item Running a script from within ipython
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ Read through the documentation of \texttt{\%hist} and find out how to list
+ all the commands between 5 and 10
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 1}
+\label{sec-3}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: %hist 5 10
+\end{lstlisting}
\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+
+ Change the label on y-axis to ``y'' and save the lines of code
+ accordingly
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 2}
+\label{sec-5}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+In []: ylabel("y")
+In []: %save /home/fossee/example_plot.py 1 3-6 10
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-6}
+ Use \texttt{\%hist} and \texttt{\%save} and create a script that has show in it and
+ run it to produce and show the plot.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 3}
+\label{sec-7}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: %hist 20
+
+In []: %save /home/fossee/show_included.py 1 3-6 8 10 13
+In []: %run -i /home/fossee/show_included.py
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 4}
+\label{sec-8}
+
+ Run the script without using the -i option. Do you find any
+ difference?
\end{frame}
+\begin{frame}
+\frametitle{Solution 4}
+\label{sec-9}
+ We see that it raises \texttt{NameError} saying the name \texttt{linspace} is not
+ found.
+\end{frame}
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-10}
+
+\begin{itemize}
+\item Retreiving history using \texttt{\%hist} command
+\item Vieweing only a part of history by passing an argument to \%hist
+\item Saving the required lines of code in required order using \%save
+\item Using \%run -i command to run the saved script
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-11}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/advanced-features-functions/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/advanced-features-functions/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -103,7 +103,7 @@
%%1%% Redefine the function ``welcome``, by interchanging it's
arguments. Place the ``name`` argument with it's default value of
-"Hello" before the ``greet`` argument.
+"World" before the ``greet`` argument.
Please, pause the video here. Do the exercise and then continue.
@@ -142,7 +142,7 @@
welcome()
-
+
Let us now learn what keyword arguments are.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/advanced-features-functions/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,86 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Advanced features of functions
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Assigning default values to arguments
+ - Calling functions using Keyword arguments
+ - functions in standard library
+* Question 1
+ Redefine the function ~welcome~, by interchanging it's
+ arguments. Place the ~name~ argument with it's default value of
+ "World" before the ~greet~ argument.
+* Solution 1
+ #+begin_src python
+ def welcome(name="World", greet):
+ print greet, name
+ #+end_src
+ We get an error that reads ~SyntaxError: non-default argument
+ follows default argument~. When defining a function all the
+ argument with default values should come at the end.
+
+* Question 2
+ See the definition of linspace using ~?~ and observe how all the
+ arguments with default values are towards the end.
+* Solution 2
+ #+begin_src python
+ linspace?
+ #+end_src
+* Question 3
+ Redefine the function ~welcome~ with a default value of
+ "Hello" to the ~greet~ argument. Then, call the function without any
+ arguments.
+* Solution 3
+ #+begin_src python
+ def welcome(greet="Hello", name="World"):
+ print greet, name
+
+ welcome()
+ #+end_src
+* Summary
+ You should now be able to --
+ + define functions with default arguments
+ + call functions using keyword arguments
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/advanced-features-functions/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/advanced-features-functions/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,125 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-11 Mon 00:34
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Advanced features of functions}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Assigning default values to arguments
+\item Calling functions using Keyword arguments
+\item functions in standard library
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ Redefine the function \texttt{welcome}, by interchanging it's
+ arguments. Place the \texttt{name} argument with it's default value of
+ ``World'' before the \texttt{greet} argument.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 1}
+\label{sec-3}
+
+\lstset{language=Python}
+\begin{lstlisting}
+def welcome(name="World", greet):
+ print greet, name
+\end{lstlisting}
+ We get an error that reads \texttt{SyntaxError: non-default argument follows default argument}. When defining a function all the
+ argument with default values should come at the end.
\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+
+ See the definition of linspace using \texttt{?} and observe how all the
+ arguments with default values are towards the end.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 2}
+\label{sec-5}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+linspace?
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-6}
+ Redefine the function \texttt{welcome} with a default value of
+ ``Hello'' to the \texttt{greet} argument. Then, call the function without any
+ arguments.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 3}
+\label{sec-7}
+
+\lstset{language=Python}
+\begin{lstlisting}
+def welcome(greet="Hello", name="World"):
+ print greet, name
+
+welcome()
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-8}
+
+ You should now be able to --
+\begin{itemize}
+\item define functions with default arguments
+\item call functions using keyword arguments
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-9}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/embellishing_a_plot/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/embellishing_a_plot/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -6,6 +6,15 @@
C -
D -
+.. By the end of this tutorial you will be able to
+
+.. * Modify the attributes of the plot -- color, line style, linewidth
+.. * Add a title to the plot with embedded LaTeX.
+.. * Label x and y axes.
+.. * Add annotations to the plot.
+.. * Set and Get the limits of axes.
+
+
.. Prerequisites
.. -------------
@@ -174,6 +183,10 @@
.. #[Madhu: I did not understand the question]
+::
+ clf()
+ plot(x, cos(x), 'r--')
+
Now that we know how to produce a bare minimum plot with colour, style
and thickness of our interest, we shall look at decorating the plot.
@@ -184,8 +197,8 @@
{{{ Show the plot window and switch back to terminal }}}
-We now have the plot in a colour and linewidth of our interest. As you can see,
-the figure does not have any description describing the plot.
+We now have the plot in a colour and linewidth of our interest. As you
+can see, the figure does not have any description describing the plot.
.. #[Madhu: Added "not". See the diff]
@@ -204,10 +217,10 @@
The formatting in title is messed and it does not look clean. You can imagine
what would be the situation if there were fractions and more complex functions
-like log and exp. Wouldn't it be good if there was LaTex like formatting?
+like log and exp. Wouldn't it be good if there was LaTeX like formatting?
That is also possible by adding a $ sign before and after the part of the
-string that should be in LaTex style.
+string that should be in LaTeX style.
for instance, we can use
::
@@ -217,9 +230,9 @@
and we get the polynomial formatted properly.
.. #[Nishanth]: Unsure if I have to give this exercise since enclosing the whole
- string in LaTex style is not good
+ string in LaTeX style is not good
-.. #[[Anoop: I guess you can go ahead with the LaTex thing, it's
+.. #[[Anoop: I guess you can go ahead with the LaTeX thing, it's
cool!]]
.. #[Madhu: Instead of saying LaTeX style you can say Typeset math
since that is how it is called as. I am not sure as well. It
@@ -228,7 +241,7 @@
{{{ Pause here and try out the following exercises }}}
%% 4 %% Change the title of the figure such that the whole title is formatted
- in LaTex style
+ in LaTeX style
{{{ continue from the paused state }}}
@@ -262,11 +275,11 @@
{{{ Pause here and try out the following exercises }}}
-%% 5 %% Set the x and y labels as "x" and "f(x)" in LaTex style.
+%% 5 %% Set the x and y labels as "x" and "f(x)" in LaTeX style.
{{{ continue from paused state }}}
-Since we need LaTex style formatting, all we have to do is enclose the string
+Since we need LaTeX style formatting, all we have to do is enclose the string
in between two $. Hence,
::
@@ -303,6 +316,10 @@
{{{ continue from paused state }}}
+::
+
+ annotate("root", xy=(-4,0))
+
As we can see, every annotate command makes a new annotation on the figure.
Now we have everything we need to decorate a plot. but the plot would be
@@ -354,7 +371,7 @@
* Modifying the attributes of plot by passing additional arguments
* How to add title
- * How to incorporate LaTex style formatting
+ * How to incorporate LaTeX style formatting
* How to label x and y axes
* How to add annotations
* How to set the limits of axes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/embellishing_a_plot/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,111 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER:\usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Embellishing a Plot
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ + Modifying the color, line style & linewidth of a plot
+ + Adding a title to the plot (with embedded LaTeX)
+ + Labelling the axes
+ + Annotating the plot
+ + Setting the limits of axes.
+* Question 1
+ Plot sin(x) in blue colour and with linewidth as 3
+* Solution 1
+ #+begin_src python
+ In []: clf()
+ In []: plot(x, sin(x), 'b', linewidth=3)
+ #+end_src
+* Question 2
+ Plot the sine curve with green filled circles.
+* Solution 2
+ #+begin_src python
+ In []: clf()
+ In []: plot(x, cos(x), 'go')
+ #+end_src
+* Question 3
+ Plot the curve of x vs tan(x) in red dashed line and linewidth 3
+* Solution 3
+ #+begin_src python
+ In []: clf()
+ In []: plot(x, cos(x), 'r--')
+ #+end_src
+* Question 4
+ Change the title of the figure such that the whole title is
+ formatted in LaTex style
+* Solution 4
+ #+begin_src python
+ In []: title("$Parabolic function -x^2+4x-5$")
+ #+end_src
+* Question 5
+ Set the x and y labels as "x" and "f(x)" in LaTex style.
+* Solution 5
+ #+begin_src python
+ In []: xlabel("$x$")
+ In []: yalbel("$f(x)$")
+ #+end_src
+* Question 6
+ Make an annotation called "root" at the point (-4, 0). What happens
+ to the first annotation?
+* Solution 6
+ #+begin_src python
+ In []: annotate("root", xy=(-4,0))
+ #+end_src
+* Question 7
+ Set the limits of axes such that the area of interest is the
+ rectangle (-1, -15) and (3, 0)
+* Solution 7
+ #+begin_src python
+ In []: xlim(-1, 3)
+ In []: ylim(-15, 0)
+ #+end_src
+* Summary
+ + Modifying the attributes of plot by passing additional arguments
+ + How to add title
+ + How to incorporate LaTeX style formatting
+ + How to label x and y axes
+ + How to add annotations
+ + How to set the limits of axes
+
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/embellishing_a_plot/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/embellishing_a_plot/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,187 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 17:32
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Embellishing a Plot}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Modifying the color, line style \& linewidth of a plot
+\item Adding a title to the plot (with embedded \LaTeX{})
+\item Labelling the axes
+\item Annotating the plot
+\item Setting the limits of axes.
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+
+ Plot sin(x) in blue colour and with linewidth as 3
\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 1}
+\label{sec-3}
+\lstset{language=Python}
+\begin{lstlisting}
+In []: clf()
+In []: plot(x, sin(x), 'b', linewidth=3)
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+
+ Plot the sine curve with green filled circles.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 2}
+\label{sec-5}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: clf()
+In []: plot(x, cos(x), 'go')
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-6}
+
+ Plot the curve of x vs tan(x) in red dashed line and linewidth 3
\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 3}
+\label{sec-7}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: clf()
+In []: plot(x, cos(x), 'r--')
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 4}
+\label{sec-8}
+
+ Change the title of the figure such that the whole title is
+ formatted in LaTex style
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 4}
+\label{sec-9}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+In []: title("$Parabolic function -x^2+4x-5$")
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 5}
+\label{sec-10}
+ Set the x and y labels as ``x'' and ``f(x)'' in LaTex style.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 5}
+\label{sec-11}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: xlabel("$x$")
+In []: yalbel("$f(x)$")
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 6}
+\label{sec-12}
+
+ Make an annotation called ``root'' at the point (-4, 0). What happens
+ to the first annotation?
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 6}
+\label{sec-13}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: annotate("root", xy=(-4,0))
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 7}
+\label{sec-14}
+
+ Set the limits of axes such that the area of interest is the
+ rectangle (-1, -15) and (3, 0)
\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 7}
+\label{sec-15}
+\lstset{language=Python}
+\begin{lstlisting}
+In []: xlim(-1, 3)
+In []: ylim(-15, 0)
+\end{lstlisting}
+\end{frame}
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-16}
+
+\begin{itemize}
+\item Modifying the attributes of plot by passing additional arguments
+\item How to add title
+\item How to incorporate \LaTeX{} style formatting
+\item How to label x and y axes
+\item How to add annotations
+\item How to set the limits of axes
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-17}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-files/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,73 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Getting started with files
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Opening and reading contents of a file
+ - Closing open files
+ - Reading all the contents of the file at once
+ - Reading files line by line
+* Question 1
+ Split the variable into a list, =pend_list=, of the lines in the
+ file. Hint, use the tab command to see what methods the string
+ variable has.
+* Solution 1
+ #+begin_src python
+ In []: pend_list = pend.splitlines()
+
+ In []: pend_list
+ #+end_src
+* Question 2
+ Re-open the file =pendulum.txt= with =f= as the file object.
+* Solution 2
+ #+begin_src python
+ In []: f = open('/home/fossee/pendulum.txt')
+ #+end_src
+* Summary
+ - Opening a file using =open= function
+ - Reading all the contents of the file at once using =read()= method
+ - Closing open files using the =close= method
+ - Reading files line by line by iterating using a =for= loop
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/getting-started-files/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/getting-started-files/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,106 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 17:51
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Getting started with files}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Opening and reading contents of a file
+\item Closing open files
+\item Reading all the contents of the file at once
+\item Reading files line by line
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ Split the variable into a list, \texttt{pend\_list}, of the lines in the
+ file. Hint, use the tab command to see what methods the string
+ variable has.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Solution 1}
+\label{sec-3}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: pend_list = pend.splitlines()
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+In []: pend_list
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+ Re-open the file \texttt{pendulum.txt} with \texttt{f} as the file object.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 2}
+\label{sec-5}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: f = open('/home/fossee/pendulum.txt')
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-6}
+
+\begin{itemize}
+\item Opening a file using \texttt{open} function
+\item Reading all the contents of the file at once using \texttt{read()} method
+\item Closing open files using the \texttt{close} method
+\item Reading files line by line by iterating using a \texttt{for} loop
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-7}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/getting-started-ipython/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/getting-started-ipython/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -105,7 +105,7 @@
Following is an exercise that you must do.
-%%1%% Type ``ab`` and hit tab to see what happens. Next, jut type
+%%1%% Type ``ab`` and hit tab to see what happens. Next, just type
``a`` and hit tab to see what happens.
Please, pause the video here. Do the exercise and then continue.
@@ -202,9 +202,16 @@
This brings us to the end of the tutorial on getting started with
``ipython``.
-In this tutorial we have learnt
+In this tutorial we have learnt, how to
{{{ show the outline/summary slide. }}}
+ 1. invoke the ``ipython`` interpreter.
+ #. quit the ``ipython`` interpreter.
+ #. navigate in the history of ``ipython``.
+ #. use tab-completion.
+ #. look-up documentation of functions.
+ #. interrupt incomplete or incorrect commands.
+
{{{ Show the "sponsored by FOSSEE" slide }}}
This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-ipython/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,61 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER:\usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Getting Started -- ~ipython~
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ + invoke the ~ipython~ interpreter
+ + quit the ~ipython~ interpreter
+ + navigate in the history of ~ipython~
+ + use tab-completion
+ + look-up documentation of functions
+ + interrupt incomplete or incorrect commands
+* Summary
+ + invoking and quitting the ~ipython~ interpreter
+ + navigating the history
+ + using tab-completion to work faster
+ + looking-up documentation using ~?~
+ + sending keyboard interrupts using ~Ctrl-C~
+
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/getting-started-ipython/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/getting-started-ipython/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,74 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 17:34
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Getting Started -- \texttt{ipython}}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
-\end{frame}
-
-\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Outline}
+\label{sec-1}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{itemize}
+\item invoke the \texttt{ipython} interpreter
+\item quit the \texttt{ipython} interpreter
+\item navigate in the history of \texttt{ipython}
+\item use tab-completion
+\item look-up documentation of functions
+\item interrupt incomplete or incorrect commands
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Summary}
+\label{sec-2}
-\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\begin{itemize}
+\item invoking and quitting the \texttt{ipython} interpreter
+\item navigating the history
+\item using tab-completion to work faster
+\item looking-up documentation using \texttt{?}
+\item sending keyboard interrupts using \texttt{Ctrl-C}
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-3}
-\begin{frame}
- \frametitle{Thank you!}
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/input_output/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/input_output/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -6,6 +6,12 @@
C -
D -
+.. #. How to print some value
+.. #. How to print using modifiers
+.. #. How to take input from user
+.. #. How to display a prompt to the user before taking the input
+
+
.. Prerequisites
.. -------------
@@ -73,7 +79,7 @@
{{{ Pause here and try out the following exercises }}}
-%% 1 %% What happens when you do print "x is %d y is %f"%(x)
+%% 1 %% What happens when you do ``print "x is %d y is %f" %(x, y)``
{{{ continue from paused state }}}
@@ -172,6 +178,9 @@
{{{ continue from paused state }}}
+.. #[Puneeth: We didn't talk of new-line character till now, did we?]
+.. #[Puneeth: non-programmers might not know?]
+
The trick is to include a newline character at the end of the prompt string.
::
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/input_output/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,84 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: I/O
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Showing output to the user.
+ - Taking input from the user.
+* Question 1
+ What happens when you do ~print "x is %d y is %f" %(x, y)~
+* Solution 1
+ ~int~ value of ~x~ and ~float~ value of ~y~ are printed corresponding to the
+ modifiers used in the ~print~ statement
+* Question 2
+ Enter the number 5.6 as input and store it in a variable called
+ ~c~.
+* Solution 2
+ #+begin_src python
+ In []: c = raw_input()
+ 5.6
+ In []: c
+ #+end_src
+* Question 3
+ What happens when you do not enter anything and hit enter
+* Solution 3
+ #+begin_src python
+ In []: c = raw_input()
+ <RET>
+ In []: c
+ #+end_src
+* Question 4
+ How do you display a prompt and let the user enter input in a new line
+* Solution 4
+ #+begin_src python
+ In []: ip = raw_input("Please enter a number in the next line\n> ")
+ #+end_src
+* Summary
+ You should now be able to --
+ + Print a value "as is"
+ + Print a value using using modifiers
+ + Accept input from user
+ + Display a prompt before accepting input
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/input_output/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/input_output/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,133 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 21:00
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{I/O}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Showing output to the user.
+\item Taking input from the user.
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+
+ What happens when you do \texttt{print "x is \%d y is \%f" \%(x, y)}
\end{frame}
+\begin{frame}
+\frametitle{Solution 1}
+\label{sec-3}
+ \texttt{int} value of \texttt{x} and \texttt{float} value of \texttt{y} are printed corresponding to the
+ modifiers used in the \texttt{print} statement
+\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+
+ Enter the number 5.6 as input and store it in a variable called
+ \texttt{c}.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 2}
+\label{sec-5}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: c = raw_input()
+5.6
+In []: c
+\end{lstlisting}
\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-6}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ What happens when you do not enter anything and hit enter
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 3}
+\label{sec-7}
+\lstset{language=Python}
+\begin{lstlisting}
+In []: c = raw_input()
+<RET>
+In []: c
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 4}
+\label{sec-8}
+
+ How do you display a prompt and let the user enter input in a new line
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 4}
+\label{sec-9}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: ip = raw_input("Please enter a number in the next line\n> ")
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-10}
+
+ You should now be able to --
+\begin{itemize}
+\item Print a value ``as is''
+\item Print a value using using modifiers
+\item Accept input from user
+\item Display a prompt before accepting input
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-11}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loading-data-from-files/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,67 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Loading data from files
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ + Read data from files with a single column of data
+ + Read data from files with multiple columns
+* Question 1
+ Read the file ~pendulum_semicolon.txt~ which contains the same data
+ as ~pendulum.txt~, but the columns are separated by semi-colons
+ instead of spaces. Use the IPython help to see how to do this.
+* Solution 1
+ #+begin_src python
+ In []: L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', unpack=True, delimiter=';')
+
+ In []: print L
+
+ In []: print T
+ #+end_src
+* Summary
+ + Read data from files, containing a single column of data using the
+ ~loadtxt~ command.
+ + Read multiple columns of data, separated by spaces or other
+ delimiters.
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/loading-data-from-files/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/loading-data-from-files/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,90 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 18:12
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Loading data from files}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Read data from files with a single column of data
+\item Read data from files with multiple columns
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ Read the file \texttt{pendulum\_semicolon.txt} which contains the same data
+ as \texttt{pendulum.txt}, but the columns are separated by semi-colons
+ instead of spaces. Use the IPython help to see how to do this.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Solution 1}
+\label{sec-3}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+In []: L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', unpack=True, delimiter=';')
+
+In []: print L
-\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+In []: print T
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-4}
+
+\begin{itemize}
+\item Read data from files, containing a single column of data using the
+ \texttt{loadtxt} command.
+\item Read multiple columns of data, separated by spaces or other
+ delimiters.
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-5}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/loops/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/loops/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -63,7 +63,7 @@
Following is an exercise that you must do.
%%1%% Write a ``while`` loop to print the squares of all the even
-numbers below 10. Then, return to the video.
+numbers below 10.
Please, pause the video here. Do the exercise and then continue.
@@ -88,8 +88,8 @@
Following is an exercise that you must do.
-%%2%% Pause the video here and write a ``for`` loop to print the
-squares of all the even numbers below 10. Then, return to the video.
+%%2%% Write a ``for`` loop to print the squares of all the even
+numbers below 10.
Please, pause the video here. Do the exercise and then continue.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loops/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,87 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Loops
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Loop while a condition is true.
+ - Iterate over a sequence
+ - Breaking out of loops.
+ - Skipping iterations.
+* Question 1
+ Write a ~while~ loop to print the squares of all the even
+ numbers below 10.
+* Solution 1
+ #+begin_src python
+ In []: i = 2
+
+ In []: while i<10:
+ ....: print i*i
+ ....: i += 2
+ #+end_src
+* Question 2
+ Write a ~for~ loop to print the squares of all the even numbers
+ below 10.
+* Solution 2
+ #+begin_src python
+ In []: for n in range(2, 10, 2):
+ ....: print n*n
+ #+end_src
+* Question 3
+ Using the ~continue~ keyword modify the ~for~ loop to print the
+ squares of even numbers below 10, to print the squares of only
+ multiples of 4. (Do not modify the range function call.)
+* Solution 3
+ #+begin_src python
+ for n in range(2, 10, 2):
+ if n%4:
+ continue
+ print n*n
+ #+end_src
+* Summary
+ You should now be able to --
+ - use the ~for~ loop
+ - use the ~while~ loop
+ - Use ~break~, ~continue~ and ~pass~ statements
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/loops/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/loops/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,128 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 21:15
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Loops}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Loop while a condition is true.
+\item Iterate over a sequence
+\item Breaking out of loops.
+\item Skipping iterations.
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ Write a \texttt{while} loop to print the squares of all the even
+ numbers below 10.
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 1}
+\label{sec-3}
+
+\lstset{language=Python}
+\begin{lstlisting}
+In []: i = 2
+
+In []: while i<10:
+ ....: print i*i
+ ....: i += 2
+\end{lstlisting}
\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+
+ Write a \texttt{for} loop to print the squares of all the even numbers
+ below 10.
+\end{frame}
+\begin{frame}[fragile]
+\frametitle{Solution 2}
+\label{sec-5}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+In []: for n in range(2, 10, 2):
+ ....: print n*n
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-6}
+ Using the \texttt{continue} keyword modify the \texttt{for} loop to print the
+ squares of even numbers below 10, to print the squares of only
+ multiples of 4. (Do not modify the range function call.)
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 3}
+\label{sec-7}
+
+\lstset{language=Python}
+\begin{lstlisting}
+for n in range(2, 10, 2):
+ if n%4:
+ continue
+ print n*n
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-8}
+
+ You should now be able to --
+\begin{itemize}
+\item use the \texttt{for} loop
+\item use the \texttt{while} loop
+\item Use \texttt{break}, \texttt{continue} and \texttt{pass} statements
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-9}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/lstsq/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/lstsq/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -6,11 +6,13 @@
C -
D -
+.. Plotting a least square fit line
+
.. Prerequisites
.. -------------
.. 1. Basic Plotting
- 2. Arrays
+.. 2. Arrays
.. Author : Nishanth Amuluru
Internal Reviewer :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lstsq/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,52 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Least square fit
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Plotting a Least square fit line
+* Summary
+ You should now be able to --
+ - Plot a least square fit line.
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/lstsq/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/lstsq/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,66 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 19:02
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Least square fit}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
-\end{frame}
-
-\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Outline}
+\label{sec-1}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{itemize}
+\item Plotting a Least square fit line
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Summary}
+\label{sec-2}
-\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+ You should now be able to --
+\begin{itemize}
+\item Plot a least square fit line.
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-3}
-\begin{frame}
- \frametitle{Thank you!}
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/parsing_data/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,84 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Parsing Data
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - What is meant by parsing data?
+ - String operations required for parsing
+ - Converting between data-types.
+* Question 1
+ Split the variable line using a space as argument. Is it same as
+ splitting without an argument ?
+* Solution 1
+ We see that when we split on space, multiple whitespaces are not
+ clubbed as one and there is an empty string everytime there are two
+ consecutive spaces.
+* Question 2
+ What happens to the white space inside the sentence when it is
+ stripped?
+* Solution 2
+ #+begin_src python
+ In []: a_str = " white space "
+ In []: a_str.strip()
+ #+end_src
+* Question 3
+ What happens if you do =int("1.25")=
+* Solution 3
+ It raises an error since converting a float string into integer
+ directly is not possible. It involves an intermediate step of
+ converting to float.
+ #+begin_src python
+ In []: dcml_str = "1.25"
+ In []: flt = float(dcml_str)
+ In []: flt
+ In []: number = int(flt)
+ In []: number
+ #+end_src
+* Summary
+ + How to tokenize a string using various delimiters
+ + How to get rid of extra white space around
+ + How to convert from one type to another
+ + How to parse input data and perform computations on it
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/parsing_data/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/parsing_data/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,124 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 18:28
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Parsing Data}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item What is meant by parsing data?
+\item String operations required for parsing
+\item Converting between data-types.
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+
+ Split the variable line using a space as argument. Is it same as
+ splitting without an argument ?
\end{frame}
+\begin{frame}
+\frametitle{Solution 1}
+\label{sec-3}
+ We see that when we split on space, multiple whitespaces are not
+ clubbed as one and there is an empty string everytime there are two
+ consecutive spaces.
+\end{frame}
+\begin{frame}
+\frametitle{Question 2}
+\label{sec-4}
+
+ What happens to the white space inside the sentence when it is
+ stripped?
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Solution 2}
+\label{sec-5}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+In []: a_str = " white space "
+In []: a_str.strip()
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Question 3}
+\label{sec-6}
+ What happens if you do \texttt{int("1.25")}
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+\frametitle{Solution 3}
+\label{sec-7}
+
+ It raises an error since converting a float string into integer
+ directly is not possible. It involves an intermediate step of
+ converting to float.
+\lstset{language=Python}
+\begin{lstlisting}
+In []: dcml_str = "1.25"
+In []: flt = float(dcml_str)
+In []: flt
+In []: number = int(flt)
+In []: number
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-8}
+
+\begin{itemize}
+\item How to tokenize a string using various delimiters
+\item How to get rid of extra white space around
+\item How to convert from one type to another
+\item How to parse input data and perform computations on it
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-9}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/sets/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/sets/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -153,7 +153,7 @@
* How to make sets from lists
* How to input sets
- * How to perform union, intersection and symmectric difference operations
+ * How to perform union, intersection and symmetric difference operations
* How to check if a set is a subset of other
* The various similarities with lists like length and containership
@@ -163,5 +163,5 @@
This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
Hope you have enjoyed and found it useful.
-Thankyou
+Thank you!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sets/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,71 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Sets
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - Defining Sets
+ - Operations on sets
+
+* Question 1
+ Given a list of marks, ~marks = [20, 23, 22, 23, 20, 21, 23]~ list
+ all the duplicates
+* Solution 1
+ #+begin_src python
+ marks = [20, 23, 22, 23, 20, 21, 23]
+ marks_set = set(marks)
+ for mark in marks_set:
+ marks.remove(mark)
+
+ # we are now left with only duplicates in the list marks
+ duplicates = set(marks)
+ #+end_src
+* Summary
+ You should now be able to --
+ + make sets from lists
+ + input sets directly
+ + perform operations like union, intersection, symmetric difference
+ + check if a subset of another
+ + check containership, length and other properties similar to lists
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/sets/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/sets/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,93 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 23:53
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Sets}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item Defining Sets
+\item Operations on sets
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ Given a list of marks, \texttt{marks = [20, 23, 22, 23, 20, 21, 23]} list
+ all the duplicates
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Solution 1}
+\label{sec-3}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+marks = [20, 23, 22, 23, 20, 21, 23]
+marks_set = set(marks)
+for mark in marks_set:
+ marks.remove(mark)
-\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+# we are now left with only duplicates in the list marks
+duplicates = set(marks)
+\end{lstlisting}
\end{frame}
-
\begin{frame}
- \frametitle{Thank you!}
+\frametitle{Summary}
+\label{sec-4}
+
+ You should now be able to --
+\begin{itemize}
+\item make sets from lists
+\item input sets directly
+\item perform operations like union, intersection, symmetric difference
+\item check if a subset of another
+\item check containership, length and other properties similar to lists
+\end{itemize}
+\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-5}
+
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the
--- a/tuples/script.rst Sun Oct 10 15:08:50 2010 +0530
+++ b/tuples/script.rst Mon Oct 11 01:05:34 2010 +0530
@@ -7,6 +7,11 @@
C -
D -
+.. #. what are tuples
+.. #. comparison with lists
+.. #. why are they needed
+
+
.. Prerequisites
.. -------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tuples/slides.org Mon Oct 11 01:05:34 2010 +0530
@@ -0,0 +1,69 @@
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+#+BEAMER_FRAME_LEVEL: 1
+
+#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
+#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
+#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
+
+#+LaTeX_CLASS: beamer
+#+LaTeX_CLASS_OPTIONS: [presentation]
+
+#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
+#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+
+#+LaTeX_HEADER: \usepackage{listings}
+
+#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+
+#+TITLE: Getting started -- Tuples
+#+AUTHOR: FOSSEE
+#+EMAIL:
+#+DATE:
+
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
+
+* Outline
+ - what are tuples
+ - comparison with lists
+ - why are they needed
+* Question 1
+ ~a = 5~ and ~b = 7~. swap the values of ~a~ and ~b~
+* Solution 1
+ #+begin_src python
+ temp = a
+ a = b
+ b = temp
+
+ a
+ b
+ #+end_src
+* Summary
+ You should now --
+ + Be able to define tuples
+ + Know the similarities with lists, like -- indexing and iterability
+ + Know about the immutability of tuples
+ + Be able to swap variables in the Pythonic way
+ + Know about packing and unpacking of tuples
+* Thank you!
+#+begin_latex
+ \begin{block}{}
+ \begin{center}
+ This spoken tutorial has been produced by the
+ \textcolor{blue}{FOSSEE} team, which is funded by the
+ \end{center}
+ \begin{center}
+ \textcolor{blue}{National Mission on Education through \\
+ Information \& Communication Technology \\
+ MHRD, Govt. of India}.
+ \end{center}
+ \end{block}
+#+end_latex
+
+
--- a/tuples/slides.tex Sun Oct 10 15:08:50 2010 +0530
+++ b/tuples/slides.tex Mon Oct 11 01:05:34 2010 +0530
@@ -1,95 +1,92 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%Tutorial slides on Python.
-%
-% Author: FOSSEE
-% Copyright (c) 2009, FOSSEE, IIT Bombay
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-\documentclass[14pt,compress]{beamer}
-%\documentclass[draft]{beamer}
-%\documentclass[compress,handout]{beamer}
-%\usepackage{pgfpages}
-%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
-
-% Modified from: generic-ornate-15min-45min.de.tex
-\mode<presentation>
-{
- \usetheme{Warsaw}
- \useoutertheme{infolines}
- \setbeamercovered{transparent}
-}
-
-\usepackage[english]{babel}
+% Created 2010-10-10 Sun 23:03
+\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
-%\usepackage{times}
\usepackage[T1]{fontenc}
-
-\usepackage{ae,aecompl}
-\usepackage{mathpazo,courier,euler}
-\usepackage[scaled=.95]{helvet}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\usepackage[english]{babel} \usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
+\usepackage{listings}
+\lstset{language=Python, basicstyle=\ttfamily\bfseries,
+commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
+showstringspaces=false, keywordstyle=\color{blue}\bfseries}
+\providecommand{\alert}[1]{\textbf{#1}}
-\definecolor{darkgreen}{rgb}{0,0.5,0}
-
-\usepackage{listings}
-\lstset{language=Python,
- basicstyle=\ttfamily\bfseries,
- commentstyle=\color{red}\itshape,
- stringstyle=\color{darkgreen},
- showstringspaces=false,
- keywordstyle=\color{blue}\bfseries}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Macros
-\setbeamercolor{emphbar}{bg=blue!20, fg=black}
-\newcommand{\emphbar}[1]
-{\begin{beamercolorbox}[rounded=true]{emphbar}
- {#1}
- \end{beamercolorbox}
-}
-\newcounter{time}
-\setcounter{time}{0}
-\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
-
-\newcommand{\typ}[1]{\lstinline{#1}}
-
-\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} }
-
-% Title page
-\title{Your Title Here}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\title{Getting started -- Tuples}
+\author{FOSSEE}
\date{}
-% DOCUMENT STARTS
+\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}
+\maketitle
+
+
+
+
+
+
+
+
+
\begin{frame}
- \maketitle
+\frametitle{Outline}
+\label{sec-1}
+
+\begin{itemize}
+\item what are tuples
+\item comparison with lists
+\item why are they needed
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Question 1}
+\label{sec-2}
+ \texttt{a = 5} and \texttt{b = 7}. swap the values of \texttt{a} and \texttt{b}
+\end{frame}
\begin{frame}[fragile]
- \frametitle{Outline}
- \begin{itemize}
- \item
- \end{itemize}
-\end{frame}
+\frametitle{Solution 1}
+\label{sec-3}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% All other slides here. %%
-%% The same slides will be used in a classroom setting. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\lstset{language=Python}
+\begin{lstlisting}
+temp = a
+a = b
+b = temp
+
+a
+b
+\end{lstlisting}
+\end{frame}
+\begin{frame}
+\frametitle{Summary}
+\label{sec-4}
-\begin{frame}[fragile]
- \frametitle{Summary}
- \begin{itemize}
- \item
- \end{itemize}
+ You should now --
+\begin{itemize}
+\item Be able to define tuples
+\item Know the similarities with lists, like -- indexing and iterability
+\item Know about the immutability of tuples
+\item Be able to swap variables in the Pythonic way
+\item Know about packing and unpacking of tuples
+\end{itemize}
\end{frame}
+\begin{frame}
+\frametitle{Thank you!}
+\label{sec-5}
-\begin{frame}
- \frametitle{Thank you!}
\begin{block}{}
\begin{center}
This spoken tutorial has been produced by the