Updated session 2 slides of day 1 and added cheatsheets of day 2.
\documentclass[12pt]{article}
\title{Python: Data Structures}
\author{FOSSEE}
\usepackage{listings}
\lstset{language=Python,
basicstyle=\ttfamily,
commentstyle=\itshape\bfseries,
showstringspaces=false
}
\newcommand{\typ}[1]{\lstinline{#1}}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage{mathpazo,courier,euler}
\usepackage[scaled=.95]{helvet}
\begin{document}
\date{}
\vspace{-1in}
\begin{center}
\LARGE{Python: Functions and Objects}\\
\large{FOSSEE}
\end{center}
\section{Functions}
Function definition
\begin{lstlisting}
def signum( r ):
if r < 0:
return -1
elif r > 0:
return 1
else:
return 0
\end{lstlisting}
Default Arguments
\begin{lstlisting}
def welcome(greet, name='world!'):
print greet, name
\end{lstlisting}
Keyword Arguments
\begin{lstlisting}
In []: plot(y, sin(y), 'g', linewidth=2)
\end{lstlisting}
Self contained python script
\begin{lstlisting}
from scipy import linspace, pi, sin
from pylab import plot, legend, annotate
from pylab import xlim, ylim
x = linspace(-5*pi, 5*pi, 500)
plot(x, x, 'b')
plot(x, -x, 'b')
plot(x, sin(x), 'g', linewidth=2)
plot(x, x*sin(x), 'r', linewidth=3)
legend(['x', '-x', 'sin(x)', 'xsin(x)'])
annotate('origin', xy = (0, 0))
xlim(-5*pi, 5*pi)
ylim(-5*pi, 5*pi)
\end{lstlisting}
\end{document}