basic-data-type/slides.tex
author anand
Mon, 15 Nov 2010 15:49:26 +0530
changeset 514 ca9d084d0c87
parent 418 8a42b4203f6d
permissions -rw-r--r--
checklist ok for `getting started with strings`

% Created 2010-11-09 Tue 15:26
\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{t1enc}
\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}}

\title{Plotting Data }
\author{FOSSEE}
\date{2010-09-14 Tue}

\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}

\maketitle









\begin{frame}
\frametitle{Outline}
\label{sec-1}
\begin{itemize}

\item Datatypes in Python
\label{sec-1_1}%
\begin{itemize}

\item Numbers\\
\label{sec-1_1_1}%
\item Boolean\\
\label{sec-1_1_2}%
\item Sequence\\
\label{sec-1_1_3}%
\end{itemize} % ends low level

\item Operators in Python
\label{sec-1_2}%
\begin{itemize}

\item Arithmetic Operators\\
\label{sec-1_2_1}%
\item Boolean Operators\\
\label{sec-1_2_2}%
\end{itemize} % ends low level

\item Python Sequence Datatypes
\label{sec-1_3}%
\begin{itemize}

\item list\\
\label{sec-1_3_1}%
\item string\\
\label{sec-1_3_2}%
\item tuple\\
\label{sec-1_3_3}%
\end{itemize} % ends low level
\end{itemize} % ends low level
\end{frame}
\begin{frame}
\frametitle{Numbers}
\label{sec-2}

\begin{itemize}
\item int
\item float
\item complex
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Question 1}
\label{sec-3}

\begin{itemize}
\item Find the absolute value of 3+4j
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Solution 1}
\label{sec-4}

\begin{verbatim}
abs(3+4j)
\end{verbatim}
\end{frame}
\begin{frame}
\frametitle{Question 2}
\label{sec-5}

\begin{itemize}
\item What is the datatype of number 999999999999999999? Is it
\end{itemize}

not int?
\end{frame}
\begin{frame}
\frametitle{Solution 2}
\label{sec-6}

\begin{itemize}
\item Long
\item Large integers numbers are internally stored in python as Long
    datatype.
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Boolean}
\label{sec-7}

\begin{verbatim}
In []: t=True
In []: f=False
\end{verbatim}
\end{frame}
\begin{frame}
\frametitle{Question 3}
\label{sec-8}

\begin{itemize}
\item Using python find sqaure root of 3?
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Solution 3}
\label{sec-9}


\begin{itemize}
\item 3**0.5
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Question 4}
\label{sec-10}

\begin{itemize}
\item Is 3**1/2 and 3**0.5 same
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Solution 4}
\label{sec-11}

\begin{itemize}
\item No,One gives an int answer and the other float
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Sequence Data types}
\label{sec-12}
\begin{itemize}

\item Properties
\label{sec-12_1}%
\begin{itemize}
\item Data in Sequence
\item Accessed using Index
\end{itemize}


\item Type
\label{sec-12_2}%
\begin{itemize}
\item list
\item String
\item Tuple
\end{itemize}


\end{itemize} % ends low level
\end{frame}
\begin{frame}[fragile]
\frametitle{All are Strings}
\label{sec-13}

\begin{verbatim}
k = 'Single quote'
l = "Double quote contain's single quote"
m = '''"Contain's both"'''
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Immutabilty Error}
\label{sec-14}

\begin{verbatim}
In []: greeting_string[1]='k'
-------------------------------------------------------
TypeError           Traceback (most recent call last)

/home/fossee/<ipython console> in <module>()

TypeError: 'str' object does not support item assignment
\end{verbatim}
\end{frame}
\begin{frame}
\frametitle{Question 5}
\label{sec-15}

  Check if 3 is an element of the list [1,7,5,3,4]. In case it is
change it to 21.
\end{frame}
\begin{frame}[fragile]
\frametitle{Solution 5}
\label{sec-16}

\begin{verbatim}
l=[1,7,5,3,4]
3 in l
l[3]=21
l
\end{verbatim}
\end{frame}
\begin{frame}
\frametitle{Question 6}
\label{sec-17}

  Convert the string \~{}''Elizabeth is queen of england''\~{} to \~{}''Elizabeth is
queen''\~{}
\end{frame}
\begin{frame}[fragile]
\frametitle{Solution 6}
\label{sec-18}

\begin{verbatim}
s = "Elizabeth is queen of england"                                                                                                                 
stemp = s.split()                                                                                                                                   
' '.join(stemp[:3])
\end{verbatim}
\end{frame}
\begin{frame}
\frametitle{Summary}
\label{sec-19}

\begin{itemize}
\item Number Datatypes -- integer,float and complex
\item Boolean and datatype and operators
\item Sequence data types -- List, String and Tuple
\item Accesing sequence
\item Slicing sequences
\item Finding length, sorting and reversing operations on sequences
\item Immutability
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Thank you!}
\label{sec-20}

  \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{frame}

\end{document}