basic-data-type/slides.tex
changeset 457 68813d8d80fb
parent 418 8a42b4203f6d
equal deleted inserted replaced
456:be96dc6c9743 457:68813d8d80fb
     1 % Created 2010-10-13 Wed 17:08
     1 % Created 2010-11-09 Tue 15:26
     2 \documentclass[presentation]{beamer}
     2 \documentclass[presentation]{beamer}
     3 \usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent}
       
     4 \usepackage[latin1]{inputenc}
     3 \usepackage[latin1]{inputenc}
     5 \usepackage[T1]{fontenc}
     4 \usepackage[T1]{fontenc}
       
     5 \usepackage{fixltx2e}
     6 \usepackage{graphicx}
     6 \usepackage{graphicx}
     7 \usepackage{longtable}
     7 \usepackage{longtable}
     8 \usepackage{float}
     8 \usepackage{float}
     9 \usepackage{wrapfig}
     9 \usepackage{wrapfig}
    10 \usepackage{soul}
    10 \usepackage{soul}
       
    11 \usepackage{t1enc}
       
    12 \usepackage{textcomp}
       
    13 \usepackage{marvosym}
       
    14 \usepackage{wasysym}
       
    15 \usepackage{latexsym}
    11 \usepackage{amssymb}
    16 \usepackage{amssymb}
    12 \usepackage{hyperref}
    17 \usepackage{hyperref}
    13 
    18 \tolerance=1000
       
    19 \usepackage[english]{babel} \usepackage{ae,aecompl}
       
    20 \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
       
    21 \usepackage{listings}
       
    22 \lstset{language=Python, basicstyle=\ttfamily\bfseries,
       
    23 commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
       
    24 showstringspaces=false, keywordstyle=\color{blue}\bfseries}
       
    25 \providecommand{\alert}[1]{\textbf{#1}}
    14 
    26 
    15 \title{Plotting Data }
    27 \title{Plotting Data }
    16 \author{FOSSEE}
    28 \author{FOSSEE}
    17 \date{2010-09-14 Tue}
    29 \date{2010-09-14 Tue}
    18 
    30 
       
    31 \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
    19 \begin{document}
    32 \begin{document}
    20 
    33 
    21 \maketitle
    34 \maketitle
    22 
    35 
    23 
    36 
    24 
    37 
    25 
    38 
    26 
    39 
    27 
    40 
    28 \begin{frame}
    41 
    29 \frametitle{Tutorial Plan}
    42 
       
    43 
       
    44 \begin{frame}
       
    45 \frametitle{Outline}
    30 \label{sec-1}
    46 \label{sec-1}
    31 \begin{itemize}
    47 \begin{itemize}
    32 
    48 
    33 \item Datatypes in Python\\
    49 \item Datatypes in Python
    34 \label{sec-1.1}%
    50 \label{sec-1_1}%
    35 \item Operators in Python\\
    51 \begin{itemize}
    36 \label{sec-1.2}%
    52 
       
    53 \item Numbers\\
       
    54 \label{sec-1_1_1}%
       
    55 \item Boolean\\
       
    56 \label{sec-1_1_2}%
       
    57 \item Sequence\\
       
    58 \label{sec-1_1_3}%
       
    59 \end{itemize} % ends low level
       
    60 
       
    61 \item Operators in Python
       
    62 \label{sec-1_2}%
       
    63 \begin{itemize}
       
    64 
       
    65 \item Arithmetic Operators\\
       
    66 \label{sec-1_2_1}%
       
    67 \item Boolean Operators\\
       
    68 \label{sec-1_2_2}%
       
    69 \end{itemize} % ends low level
       
    70 
       
    71 \item Python Sequence Datatypes
       
    72 \label{sec-1_3}%
       
    73 \begin{itemize}
       
    74 
       
    75 \item list\\
       
    76 \label{sec-1_3_1}%
       
    77 \item string\\
       
    78 \label{sec-1_3_2}%
       
    79 \item tuple\\
       
    80 \label{sec-1_3_3}%
       
    81 \end{itemize} % ends low level
    37 \end{itemize} % ends low level
    82 \end{itemize} % ends low level
    38 \end{frame}
    83 \end{frame}
    39 \begin{frame}
    84 \begin{frame}
    40 \frametitle{Numbers}
    85 \frametitle{Numbers}
    41 \label{sec-2}
    86 \label{sec-2}
    42 \begin{itemize}
    87 
    43 
    88 \begin{itemize}
    44 \item Integers\\
    89 \item int
    45 \label{sec-2.1}%
    90 \item float
    46 \item Float\\
    91 \item complex
    47 \label{sec-2.2}%
    92 \end{itemize}
    48 \item Complex\\
    93 \end{frame}
    49 \label{sec-2.3}%
    94 \begin{frame}
    50 \end{itemize} % ends low level
    95 \frametitle{Question 1}
    51 \end{frame}
    96 \label{sec-3}
    52 \begin{frame}
    97 
       
    98 \begin{itemize}
       
    99 \item Find the absolute value of 3+4j
       
   100 \end{itemize}
       
   101 \end{frame}
       
   102 \begin{frame}[fragile]
       
   103 \frametitle{Solution 1}
       
   104 \label{sec-4}
       
   105 
       
   106 \begin{verbatim}
       
   107 abs(3+4j)
       
   108 \end{verbatim}
       
   109 \end{frame}
       
   110 \begin{frame}
       
   111 \frametitle{Question 2}
       
   112 \label{sec-5}
       
   113 
       
   114 \begin{itemize}
       
   115 \item What is the datatype of number 999999999999999999? Is it
       
   116 \end{itemize}
       
   117 
       
   118 not int?
       
   119 \end{frame}
       
   120 \begin{frame}
       
   121 \frametitle{Solution 2}
       
   122 \label{sec-6}
       
   123 
       
   124 \begin{itemize}
       
   125 \item Long
       
   126 \item Large integers numbers are internally stored in python as Long
       
   127     datatype.
       
   128 \end{itemize}
       
   129 \end{frame}
       
   130 \begin{frame}[fragile]
    53 \frametitle{Boolean}
   131 \frametitle{Boolean}
    54 \label{sec-3}
   132 \label{sec-7}
    55 \begin{itemize}
   133 
    56 
   134 \begin{verbatim}
    57 \item True\\
   135 In []: t=True
    58 \label{sec-3.1}%
   136 In []: f=False
    59 \item False\\
   137 \end{verbatim}
    60 \label{sec-3.2}%
   138 \end{frame}
    61 \end{itemize} % ends low level
   139 \begin{frame}
       
   140 \frametitle{Question 3}
       
   141 \label{sec-8}
       
   142 
       
   143 \begin{itemize}
       
   144 \item Using python find sqaure root of 3?
       
   145 \end{itemize}
       
   146 \end{frame}
       
   147 \begin{frame}
       
   148 \frametitle{Solution 3}
       
   149 \label{sec-9}
       
   150 
       
   151 
       
   152 \begin{itemize}
       
   153 \item 3**0.5
       
   154 \end{itemize}
       
   155 \end{frame}
       
   156 \begin{frame}
       
   157 \frametitle{Question 4}
       
   158 \label{sec-10}
       
   159 
       
   160 \begin{itemize}
       
   161 \item Is 3**1/2 and 3**0.5 same
       
   162 \end{itemize}
       
   163 \end{frame}
       
   164 \begin{frame}
       
   165 \frametitle{Solution 4}
       
   166 \label{sec-11}
       
   167 
       
   168 \begin{itemize}
       
   169 \item No,One gives an int answer and the other float
       
   170 \end{itemize}
    62 \end{frame}
   171 \end{frame}
    63 \begin{frame}
   172 \begin{frame}
    64 \frametitle{Sequence Data types}
   173 \frametitle{Sequence Data types}
    65 \label{sec-4}
   174 \label{sec-12}
    66 \begin{itemize}
   175 \begin{itemize}
    67 
   176 
    68 \item Data in Sequence\\
   177 \item Properties
    69 \label{sec-4.1}%
   178 \label{sec-12_1}%
       
   179 \begin{itemize}
       
   180 \item Data in Sequence
    70 \item Accessed using Index
   181 \item Accessed using Index
    71 \label{sec-4.2}%
   182 \end{itemize}
    72 \begin{itemize}
   183 
    73 
   184 
    74 \item list\\
   185 \item Type
    75 \label{sec-4.2.1}%
   186 \label{sec-12_2}%
    76 \item String\\
   187 \begin{itemize}
    77 \label{sec-4.2.2}%
   188 \item list
    78 \item Tuple\\
   189 \item String
    79 \label{sec-4.2.3}%
   190 \item Tuple
    80 \end{itemize} % ends low level
   191 \end{itemize}
    81 \end{itemize} % ends low level
   192 
    82 \end{frame}
   193 
    83 \begin{frame}
   194 \end{itemize} % ends low level
       
   195 \end{frame}
       
   196 \begin{frame}[fragile]
    84 \frametitle{All are Strings}
   197 \frametitle{All are Strings}
    85 \label{sec-5}
   198 \label{sec-13}
    86 \begin{itemize}
   199 
    87 
   200 \begin{verbatim}
    88 \item k='Single quote'\\
   201 k = 'Single quote'
    89 \label{sec-5.1}%
   202 l = "Double quote contain's single quote"
    90 \item l="Double quote contain's single quote"\\
   203 m = '''"Contain's both"'''
    91 \label{sec-5.2}%
   204 \end{verbatim}
    92 \item m='''"Contain's both"'''\\
   205 \end{frame}
    93 \label{sec-5.3}%
   206 \begin{frame}[fragile]
    94 \end{itemize} % ends low level
   207 \frametitle{Immutabilty Error}
       
   208 \label{sec-14}
       
   209 
       
   210 \begin{verbatim}
       
   211 In []: greeting_string[1]='k'
       
   212 -------------------------------------------------------
       
   213 TypeError           Traceback (most recent call last)
       
   214 
       
   215 /home/fossee/<ipython console> in <module>()
       
   216 
       
   217 TypeError: 'str' object does not support item assignment
       
   218 \end{verbatim}
       
   219 \end{frame}
       
   220 \begin{frame}
       
   221 \frametitle{Question 5}
       
   222 \label{sec-15}
       
   223 
       
   224   Check if 3 is an element of the list [1,7,5,3,4]. In case it is
       
   225 change it to 21.
       
   226 \end{frame}
       
   227 \begin{frame}[fragile]
       
   228 \frametitle{Solution 5}
       
   229 \label{sec-16}
       
   230 
       
   231 \begin{verbatim}
       
   232 l=[1,7,5,3,4]
       
   233 3 in l
       
   234 l[3]=21
       
   235 l
       
   236 \end{verbatim}
       
   237 \end{frame}
       
   238 \begin{frame}
       
   239 \frametitle{Question 6}
       
   240 \label{sec-17}
       
   241 
       
   242   Convert the string \~{}''Elizabeth is queen of england''\~{} to \~{}''Elizabeth is
       
   243 queen''\~{}
       
   244 \end{frame}
       
   245 \begin{frame}[fragile]
       
   246 \frametitle{Solution 6}
       
   247 \label{sec-18}
       
   248 
       
   249 \begin{verbatim}
       
   250 s = "Elizabeth is queen of england"                                                                                                                 
       
   251 stemp = s.split()                                                                                                                                   
       
   252 ' '.join(stemp[:3])
       
   253 \end{verbatim}
    95 \end{frame}
   254 \end{frame}
    96 \begin{frame}
   255 \begin{frame}
    97 \frametitle{Summary}
   256 \frametitle{Summary}
    98 \label{sec-6}
   257 \label{sec-19}
    99 \begin{itemize}
   258 
   100 
   259 \begin{itemize}
   101 \item a=73\\
   260 \item Number Datatypes -- integer,float and complex
   102 \label{sec-6.1}%
   261 \item Boolean and datatype and operators
   103 \item b=3.14\\
   262 \item Sequence data types -- List, String and Tuple
   104 \label{sec-6.2}%
   263 \item Accesing sequence
   105 \item c=3+4j\\
   264 \item Slicing sequences
   106 \label{sec-6.3}%
   265 \item Finding length, sorting and reversing operations on sequences
   107 \end{itemize} % ends low level
   266 \item Immutability
   108 \end{frame}
   267 \end{itemize}
   109 \begin{frame}
   268 \end{frame}
   110 \frametitle{Summary Contd.}
   269 \begin{frame}
   111 \label{sec-7}
   270 \frametitle{Thank you!}
   112 \begin{itemize}
   271 \label{sec-20}
   113 
   272 
   114 \item t=True\\
   273   \begin{block}{}
   115 \label{sec-7.1}%
   274   \begin{center}
   116 \item f=False\\
   275   This spoken tutorial has been produced by the
   117 \label{sec-7.2}%
   276   \textcolor{blue}{FOSSEE} team, which is funded by the 
   118 \item t and f\\
   277   \end{center}
   119 \label{sec-7.3}%
   278   \begin{center}
   120 \end{itemize} % ends low level
   279     \textcolor{blue}{National Mission on Education through \\
   121 \end{frame}
   280       Information \& Communication Technology \\ 
   122 \begin{frame}
   281       MHRD, Govt. of India}.
   123 \frametitle{Summary Contd.}
   282   \end{center}  
   124 \label{sec-8}
   283   \end{block}
   125 \begin{itemize}
       
   126 
       
   127 \item l= [2,1,4,3]\\
       
   128 \label{sec-8.1}%
       
   129 \item s='hello'\\
       
   130 \label{sec-8.2}%
       
   131 \item tu=(1,2,3,4)\\
       
   132 \label{sec-8.3}%
       
   133 \end{itemize} % ends low level
       
   134 \end{frame}
       
   135 \begin{frame}
       
   136 \frametitle{Summary Contd.}
       
   137 \label{sec-9}
       
   138 \begin{itemize}
       
   139 
       
   140 \item tu[-1]\\
       
   141 \label{sec-9.1}%
       
   142 \item s[1:-1]\\
       
   143 \label{sec-9.2}%
       
   144 \end{itemize} % ends low level
       
   145 \end{frame}
       
   146 \begin{frame}
       
   147 \frametitle{Summary Contd.}
       
   148 \label{sec-10}
       
   149 \begin{itemize}
       
   150 
       
   151 \item Sorted(l)\\
       
   152 \label{sec-10.1}%
       
   153 \item reversed(s)\\
       
   154 \label{sec-10.2}%
       
   155 \end{itemize} % ends low level
       
   156 \end{frame}
   284 \end{frame}
   157 
   285 
   158 \end{document}
   286 \end{document}