basic-data-type/slides.org
changeset 406 a534e9e79599
parent 337 c65d0d9fc0c8
child 412 bb45826efe74
child 416 06ac45f4de88
equal deleted inserted replaced
403:9858ca9e3f93 406:a534e9e79599
     1 #+LaTeX_CLASS: beamer
     1 #+LaTeX_CLASS: beamer
     2 #+LaTeX_CLASS_OPTIONS: [presentation]
     2 #+LaTeX_CLASS_OPTIONS: [presentation]
     3 #+BEAMER_FRAME_LEVEL: 1
     3 #+BEAMER_FRAME_LEVEL: 1
     4 
     4 
     5 #+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent}
     5 #+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
     6 #+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
     6 #+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
     7 #+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
     7 #+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC
     8 #+OPTIONS:   H:5 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
     8 
       
     9 #+LaTeX_CLASS: beamer
       
    10 #+LaTeX_CLASS_OPTIONS: [presentation]
       
    11 
       
    12 #+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
       
    13 #+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
       
    14 
       
    15 #+LaTeX_HEADER: \usepackage{listings}
       
    16 
       
    17 #+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
       
    18 #+LaTeX_HEADER:  commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
       
    19 #+LaTeX_HEADER:  showstringspaces=false, keywordstyle=\color{blue}\bfseries}
     9 
    20 
    10 #+TITLE: Plotting Data 
    21 #+TITLE: Plotting Data 
    11 #+AUTHOR: FOSSEE
    22 #+AUTHOR: FOSSEE
    12 #+DATE: 2010-09-14 Tue
    23 #+DATE: 2010-09-14 Tue
    13 #+EMAIL:     info@fossee.in
    24 #+EMAIL:     info@fossee.in
    14 
    25 
    15 # \author[FOSSEE] {FOSSEE}
    26 #+DESCRIPTION: 
       
    27 #+KEYWORDS: 
       
    28 #+LANGUAGE:  en
       
    29 #+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
       
    30 #+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
    16 
    31 
    17 # \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
       
    18 # \date{}
       
    19 
    32 
    20 * Tutorial Plan 
    33 * Outline 
    21 ** Datatypes in Python
    34 ** Datatypes in Python
    22 ** Operators in Python
    35     - Numbers
       
    36     - Boolean
       
    37     - Sequence
       
    38 **  Operators in Python
       
    39     - Arithmetic Operators
       
    40     - Boolean Operators
       
    41 ** Python Sequence Datatypes
       
    42    - list
       
    43    - string
       
    44    - tuple
    23 
    45 
    24 * Numbers
    46 * Numbers
    25 ** Integers
    47   - Integers
    26 ** Float
    48   - Float
    27 ** Complex
    49   - Complex
       
    50 * Question 1
       
    51    - Find the absolute value of 3+4j 
       
    52 * Solution 1
       
    53 
       
    54         abs(3+4j)
       
    55 
       
    56 * Question 2
       
    57   - What is the datatype of number 999999999999999999? Is it
       
    58 not int?
       
    59 
       
    60 * Solution 2
       
    61         
       
    62         - Long
       
    63         - Large integers numbers are internally stored in python
       
    64         as Long datatype.  
       
    65 
    28 
    66 
    29 * Boolean
    67 * Boolean
    30 ** True
    68   #+begin_src python
    31 ** False
    69     In []: t=True
       
    70     In []: f=False
       
    71   #+end_src
       
    72 
       
    73 * Question 1
       
    74   - Using python find sqaure root of 3?
       
    75 
       
    76 * Solution 1
       
    77 
       
    78   - 3**0.5
       
    79 
       
    80 * Question 2
       
    81   - Is 3**1/2 and 3**0.5 same
       
    82 * Solution 2
       
    83   - No,One gives an int answer and the other float        
    32 
    84 
    33 * Sequence Data types
    85 * Sequence Data types
    34 ** Data in Sequence 
    86 ** Properties
    35 ** Accessed using Index
    87  - Data in Sequence 
    36 *** list
    88  - Accessed using Index
    37 *** String
    89 ** Type
    38 *** Tuple
    90  - list
       
    91  - String
       
    92  - Tuple
    39 
    93 
    40 * All are Strings
    94 * All are Strings
       
    95    #+begin_src python 
       
    96       k='Single quote'
       
    97       l="Double quote contain's single quote"
       
    98       m='''"Contain's both"'''
    41 
    99 
    42 ** k='Single quote'
   100     #+end_src 
    43 ** l="Double quote contain's single quote"
   101 * Immutabilty Error
    44 ** m='''"Contain's both"'''
   102    #+begin_src python
       
   103       In []: greeting_string[1]='k'
       
   104       ---------------------------------------------------------------------------
       
   105       TypeError                                 Traceback (most recent call       last)
    45 
   106 
       
   107       /home/amit/st-scripts/basic-data-type/<ipython console> in <module>()
       
   108 
       
   109       TypeError: 'str' object does not support item assignment
       
   110    #+end_src 
       
   111 
       
   112 * Question 1
       
   113    - Check if 3 is an element of the list [1,7,5,3,4]. In case
       
   114 it is change it to 21.
       
   115 
       
   116 * Solution 1
       
   117      #+begin_src python
       
   118         l=[1,7,5,3,4]
       
   119         3 in l
       
   120         l[3]=21
       
   121         l
       
   122      #+end_src
       
   123 * Question 2
       
   124   - Convert the string "Elizabeth is queen of england" to
       
   125 "Elizabeth is queen"
       
   126 
       
   127 * Solution 2
       
   128      #+begin_src python
       
   129     s="Elizabeth is queen of england"                                                                                                                 
       
   130     stemp=s.split()                                                                                                                                   
       
   131     ' '.join(stemp[:3])                                                                                                                               
       
   132     #+end_src 
    46 * Summary 
   133 * Summary 
    47 ** a=73
   134    #+begin_src python 
    48 ** b=3.14
   135     a=73
    49 ** c=3+4j
   136     b=3.14
       
   137     c=3+4j
    50 
   138 
       
   139    #+end_src
    51 * Summary Contd.
   140 * Summary Contd.
    52 
   141    #+begin_src python
    53 ** t=True
   142      t=True
    54 ** f=False
   143      f=False
    55 ** t and f
   144      t and f
    56 
   145    #+end_src
    57 * Summary Contd.
   146 * Summary Contd.
    58 ** l= [2,1,4,3]
   147    #+begin_src python 
    59 ** s='hello'
   148      l= [2,1,4,3]
    60 ** tu=(1,2,3,4)
   149      s='hello'
    61 
   150      tu=(1,2,3,4)
       
   151    #+end_src
    62 * Summary Contd.
   152 * Summary Contd.
    63 ** tu[-1]
   153    #+begin_src python 
    64 ** s[1:-1]
   154      tu[-1]
    65 
   155      s[1:-1]
       
   156    #+end_src
    66 * Summary Contd.
   157 * Summary Contd.
    67 
   158    #+begin_src python  
    68 ** Sorted(l)
   159      Sorted(l)
    69 ** reversed(s)
   160    #+end_src
    70 
   161 * Thank you!
    71 * COMMENT 
   162 #+begin_latex
    72 # [Puneeth: Where is the last slide?]
   163   \begin{block}{}
    73 # [Puneeth: Why don't you use the template slides.org?]
   164   \begin{center}
       
   165   This spoken tutorial has been produced by the
       
   166   \textcolor{blue}{FOSSEE} team, which is funded by the 
       
   167   \end{center}
       
   168   \begin{center}
       
   169     \textcolor{blue}{National Mission on Education through \\
       
   170       Information \& Communication Technology \\ 
       
   171       MHRD, Govt. of India}.
       
   172   \end{center}  
       
   173   \end{block}
       
   174 #+end_latex
    74 
   175 
    75 
   176 
       
   177 
       
   178 
       
   179