\documentclass[12pt]{article}
\title{Interactive Plotting}
\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{Statistics and Least square fit}\\
\large{FOSSEE}
\end{center}
\section{Statistics}
Dictionary
\begin{lstlisting}
In []: d = {"Hitchhiker's guide" : 42, 
 ....:      "Terminator" : "I'll be back"} #Creation
In []: d["Hitchhiker's guide"] # Accessing a value with key
In []: "Hitchhiker's guide" in d #Checking for a key
In []: d.keys() # Obtaining List of Keys
In []: d.values() # Obtaining List of Values
\end{lstlisting}
Iterating through List indices
\begin{lstlisting}
In []: names = ["Guido","Alex", "Tim"]
In []: for i, name in enumerate(names):
  ...:     print i, name
\end{lstlisting}
Computing Mean value of `\texttt{g}'
\begin{lstlisting}
In []: G = []
In []: for line in open('pendulum.txt'):
  ....     points = line.split()
  ....     l = float(points[0])
  ....     t = float(points[1])
  ....     g = 4 * pi * pi * l / t * t
  ....     G.append(g)
\end{lstlisting}
sum() and len() functions
\begin{lstlisting}
  total = 0
  for g in G:
    total += g
  mean_g = total / len(g)

  mean_g = sum(G) / len(G)
  mean_g = mean(G)
\end{lstlisting}
\newpage
Ternary Operator
\begin{lstlisting}
In []: score = int(score_str) if score_str != 'AA' else 0
\end{lstlisting}
Drawing Pie Charts
\begin{lstlisting}
In []: pie(science.values(), labels=science.keys())
\end{lstlisting}
Arrays
\begin{lstlisting}
In []: a = array([1, 2, 3]) #Creating
In []: b = array([4, 5, 6])
In []: a + b #Sum; Element-wise
\end{lstlisting}
Numpy statistical operations 
\begin{lstlisting}
In []: mean(math_scores) 
In []: median(math_scores)
In []: std(math_scores)
\end{lstlisting}
\end{document}
