basic-data-type/slides.tex
changeset 406 a534e9e79599
parent 320 223044cf254f
child 412 bb45826efe74
equal deleted inserted replaced
403:9858ca9e3f93 406:a534e9e79599
     1 % Created 2010-10-13 Wed 17:08
     1 % Created 2010-11-09 Tue 01:27
     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 
       
    45 \begin{frame}
       
    46 \frametitle{Outline}
    30 \label{sec-1}
    47 \label{sec-1}
    31 \begin{itemize}
    48 \begin{itemize}
    32 
    49 
    33 \item Datatypes in Python\\
    50 \item Datatypes in Python
    34 \label{sec-1.1}%
    51 \label{sec-1_1}%
    35 \item Operators in Python\\
    52 \begin{itemize}
    36 \label{sec-1.2}%
    53 \item Numbers
       
    54 \item Boolean
       
    55 \item Sequence
       
    56 \end{itemize}
       
    57 
       
    58 
       
    59 \item Operators in Python
       
    60 \label{sec-1_2}%
       
    61 \begin{itemize}
       
    62 \item Arithmetic Operators
       
    63 \item Boolean Operators
       
    64 \end{itemize}
       
    65 
       
    66 
       
    67 \item Python Sequence Datatypes
       
    68 \label{sec-1_3}%
       
    69 \begin{itemize}
       
    70 \item list
       
    71 \item string
       
    72 \item tuple
       
    73 \end{itemize}
       
    74 
       
    75 
    37 \end{itemize} % ends low level
    76 \end{itemize} % ends low level
    38 \end{frame}
    77 \end{frame}
    39 \begin{frame}
    78 \begin{frame}
    40 \frametitle{Numbers}
    79 \frametitle{Numbers}
    41 \label{sec-2}
    80 \label{sec-2}
    42 \begin{itemize}
    81 
    43 
    82 \begin{itemize}
    44 \item Integers\\
    83 \item Integers
    45 \label{sec-2.1}%
    84 \item Float
    46 \item Float\\
    85 \item Complex
    47 \label{sec-2.2}%
    86 \end{itemize}
    48 \item Complex\\
    87 \end{frame}
    49 \label{sec-2.3}%
    88 \begin{frame}
       
    89 \frametitle{Question 1}
       
    90 \label{sec-3}
       
    91 
       
    92 \begin{itemize}
       
    93 \item Find the absolute value of 3+4j
       
    94 \end{itemize}
       
    95 \end{frame}
       
    96 \begin{frame}
       
    97 \frametitle{Solution 1}
       
    98 \label{sec-4}
       
    99 
       
   100 
       
   101         abs(3+4j)
       
   102 \end{frame}
       
   103 \begin{frame}
       
   104 \frametitle{Question 2}
       
   105 \label{sec-5}
       
   106 
       
   107 \begin{itemize}
       
   108 \item What is the datatype of number 999999999999999999? Is it
       
   109 \end{itemize}
       
   110 
       
   111 not int?
       
   112 \end{frame}
       
   113 \begin{frame}
       
   114 \frametitle{Solution 2}
       
   115 \label{sec-6}
       
   116 
       
   117         
       
   118 \begin{itemize}
       
   119 \item Long
       
   120 \item Large integers numbers are internally stored in python
       
   121 \end{itemize}
       
   122 
       
   123         as Long datatype.  
       
   124 \end{frame}
       
   125 \begin{frame}[fragile]
       
   126 \frametitle{Boolean}
       
   127 \label{sec-7}
       
   128 
       
   129 \begin{verbatim}
       
   130 In []: t=True
       
   131 In []: f=False
       
   132 \end{verbatim}
       
   133 \end{frame}
       
   134 \begin{frame}
       
   135 \frametitle{Question 1}
       
   136 \label{sec-8}
       
   137 
       
   138 \begin{itemize}
       
   139 \item Using python find sqaure root of 3?
       
   140 \end{itemize}
       
   141 \end{frame}
       
   142 \begin{frame}
       
   143 \frametitle{Solution 1}
       
   144 \label{sec-9}
       
   145 
       
   146 
       
   147 \begin{itemize}
       
   148 \item 3**0.5
       
   149 \end{itemize}
       
   150 \end{frame}
       
   151 \begin{frame}
       
   152 \frametitle{Question 2}
       
   153 \label{sec-10}
       
   154 
       
   155 \begin{itemize}
       
   156 \item Is 3**1/2 and 3**0.5 same
       
   157 \end{itemize}
       
   158 \end{frame}
       
   159 \begin{frame}
       
   160 \frametitle{Solution 2}
       
   161 \label{sec-11}
       
   162 
       
   163 \begin{itemize}
       
   164 \item No,One gives an int answer and the other float
       
   165 \end{itemize}
       
   166 \end{frame}
       
   167 \begin{frame}
       
   168 \frametitle{Sequence Data types}
       
   169 \label{sec-12}
       
   170 \begin{itemize}
       
   171 
       
   172 \item Properties
       
   173 \label{sec-12_1}%
       
   174 \begin{itemize}
       
   175 \item Data in Sequence
       
   176 \item Accessed using Index
       
   177 \end{itemize}
       
   178 
       
   179 
       
   180 \item Type
       
   181 \label{sec-12_2}%
       
   182 \begin{itemize}
       
   183 \item list
       
   184 \item String
       
   185 \item Tuple
       
   186 \end{itemize}
       
   187 
       
   188 
    50 \end{itemize} % ends low level
   189 \end{itemize} % ends low level
    51 \end{frame}
   190 \end{frame}
    52 \begin{frame}
   191 \begin{frame}[fragile]
    53 \frametitle{Boolean}
       
    54 \label{sec-3}
       
    55 \begin{itemize}
       
    56 
       
    57 \item True\\
       
    58 \label{sec-3.1}%
       
    59 \item False\\
       
    60 \label{sec-3.2}%
       
    61 \end{itemize} % ends low level
       
    62 \end{frame}
       
    63 \begin{frame}
       
    64 \frametitle{Sequence Data types}
       
    65 \label{sec-4}
       
    66 \begin{itemize}
       
    67 
       
    68 \item Data in Sequence\\
       
    69 \label{sec-4.1}%
       
    70 \item Accessed using Index
       
    71 \label{sec-4.2}%
       
    72 \begin{itemize}
       
    73 
       
    74 \item list\\
       
    75 \label{sec-4.2.1}%
       
    76 \item String\\
       
    77 \label{sec-4.2.2}%
       
    78 \item Tuple\\
       
    79 \label{sec-4.2.3}%
       
    80 \end{itemize} % ends low level
       
    81 \end{itemize} % ends low level
       
    82 \end{frame}
       
    83 \begin{frame}
       
    84 \frametitle{All are Strings}
   192 \frametitle{All are Strings}
    85 \label{sec-5}
   193 \label{sec-13}
    86 \begin{itemize}
   194 
    87 
   195 \begin{verbatim}
    88 \item k='Single quote'\\
   196 k='Single quote'
    89 \label{sec-5.1}%
   197 l="Double quote contain's single quote"
    90 \item l="Double quote contain's single quote"\\
   198 m='''"Contain's both"'''
    91 \label{sec-5.2}%
   199 \end{verbatim}
    92 \item m='''"Contain's both"'''\\
   200 \end{frame}
    93 \label{sec-5.3}%
   201 \begin{frame}[fragile]
    94 \end{itemize} % ends low level
   202 \frametitle{Immutabilty Error}
    95 \end{frame}
   203 \label{sec-14}
    96 \begin{frame}
   204 
       
   205 \begin{verbatim}
       
   206 In []: greeting_string[1]='k'
       
   207 ---------------------------------------------------------------------------
       
   208 TypeError                                 Traceback (most recent call       last)
       
   209 
       
   210 /home/amit/st-scripts/basic-data-type/<ipython console> in <module>()
       
   211 
       
   212 TypeError: 'str' object does not support item assignment
       
   213 \end{verbatim}
       
   214 \end{frame}
       
   215 \begin{frame}
       
   216 \frametitle{Question 1}
       
   217 \label{sec-15}
       
   218 
       
   219 \begin{itemize}
       
   220 \item Check if 3 is an element of the list [1,7,5,3,4]. In case
       
   221 \end{itemize}
       
   222 
       
   223 it is change it to 21.
       
   224 \end{frame}
       
   225 \begin{frame}[fragile]
       
   226 \frametitle{Solution 1}
       
   227 \label{sec-16}
       
   228 
       
   229 \begin{verbatim}
       
   230 l=[1,7,5,3,4]
       
   231 3 in l
       
   232 l[3]=21
       
   233 l
       
   234 \end{verbatim}
       
   235 \end{frame}
       
   236 \begin{frame}
       
   237 \frametitle{Question 2}
       
   238 \label{sec-17}
       
   239 
       
   240 \begin{itemize}
       
   241 \item Convert the string ``Elizabeth is queen of england'' to
       
   242 \end{itemize}
       
   243 
       
   244 ``Elizabeth is queen''
       
   245 \end{frame}
       
   246 \begin{frame}[fragile]
       
   247 \frametitle{Solution 2}
       
   248 \label{sec-18}
       
   249 
       
   250 \begin{verbatim}
       
   251 s="Elizabeth is queen of england"                                                                                                                 
       
   252 stemp=s.split()                                                                                                                                   
       
   253 ' '.join(stemp[:3])
       
   254 \end{verbatim}
       
   255 \end{frame}
       
   256 \begin{frame}[fragile]
    97 \frametitle{Summary}
   257 \frametitle{Summary}
    98 \label{sec-6}
   258 \label{sec-19}
    99 \begin{itemize}
   259 
   100 
   260 \begin{verbatim}
   101 \item a=73\\
   261 a=73
   102 \label{sec-6.1}%
   262 b=3.14
   103 \item b=3.14\\
   263 c=3+4j
   104 \label{sec-6.2}%
   264 \end{verbatim}
   105 \item c=3+4j\\
   265 \end{frame}
   106 \label{sec-6.3}%
   266 \begin{frame}[fragile]
   107 \end{itemize} % ends low level
       
   108 \end{frame}
       
   109 \begin{frame}
       
   110 \frametitle{Summary Contd.}
   267 \frametitle{Summary Contd.}
   111 \label{sec-7}
   268 \label{sec-20}
   112 \begin{itemize}
   269 
   113 
   270 \begin{verbatim}
   114 \item t=True\\
   271 t=True
   115 \label{sec-7.1}%
   272 f=False
   116 \item f=False\\
   273 t and f
   117 \label{sec-7.2}%
   274 \end{verbatim}
   118 \item t and f\\
   275 \end{frame}
   119 \label{sec-7.3}%
   276 \begin{frame}[fragile]
   120 \end{itemize} % ends low level
       
   121 \end{frame}
       
   122 \begin{frame}
       
   123 \frametitle{Summary Contd.}
   277 \frametitle{Summary Contd.}
   124 \label{sec-8}
   278 \label{sec-21}
   125 \begin{itemize}
   279 
   126 
   280 \begin{verbatim}
   127 \item l= [2,1,4,3]\\
   281 l= [2,1,4,3]
   128 \label{sec-8.1}%
   282 s='hello'
   129 \item s='hello'\\
   283 tu=(1,2,3,4)
   130 \label{sec-8.2}%
   284 \end{verbatim}
   131 \item tu=(1,2,3,4)\\
   285 \end{frame}
   132 \label{sec-8.3}%
   286 \begin{frame}[fragile]
   133 \end{itemize} % ends low level
       
   134 \end{frame}
       
   135 \begin{frame}
       
   136 \frametitle{Summary Contd.}
   287 \frametitle{Summary Contd.}
   137 \label{sec-9}
   288 \label{sec-22}
   138 \begin{itemize}
   289 
   139 
   290 \begin{verbatim}
   140 \item tu[-1]\\
   291 tu[-1]
   141 \label{sec-9.1}%
   292 s[1:-1]
   142 \item s[1:-1]\\
   293 \end{verbatim}
   143 \label{sec-9.2}%
   294 \end{frame}
   144 \end{itemize} % ends low level
   295 \begin{frame}[fragile]
   145 \end{frame}
       
   146 \begin{frame}
       
   147 \frametitle{Summary Contd.}
   296 \frametitle{Summary Contd.}
   148 \label{sec-10}
   297 \label{sec-23}
   149 \begin{itemize}
   298 
   150 
   299 \begin{verbatim}
   151 \item Sorted(l)\\
   300 Sorted(l)
   152 \label{sec-10.1}%
   301 \end{verbatim}
   153 \item reversed(s)\\
   302 \end{frame}
   154 \label{sec-10.2}%
   303 \begin{frame}
   155 \end{itemize} % ends low level
   304 \frametitle{Thank you!}
       
   305 \label{sec-24}
       
   306 
       
   307   \begin{block}{}
       
   308   \begin{center}
       
   309   This spoken tutorial has been produced by the
       
   310   \textcolor{blue}{FOSSEE} team, which is funded by the 
       
   311   \end{center}
       
   312   \begin{center}
       
   313     \textcolor{blue}{National Mission on Education through \\
       
   314       Information \& Communication Technology \\ 
       
   315       MHRD, Govt. of India}.
       
   316   \end{center}  
       
   317   \end{block}
   156 \end{frame}
   318 \end{frame}
   157 
   319 
   158 \end{document}
   320 \end{document}