basic-data-type/slides.org
changeset 457 68813d8d80fb
parent 418 8a42b4203f6d
equal deleted inserted replaced
456:be96dc6c9743 457:68813d8d80fb
     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:1 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
       
    31 #+STARTUP:    align fold nodlcheck hidestars oddeven lognotestate
    16 
    32 
    17 # \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    33 * Outline 
    18 # \date{}
       
    19 
       
    20 * Tutorial Plan 
       
    21 ** Datatypes in Python
    34 ** Datatypes in Python
       
    35 *** Numbers
       
    36 *** Boolean
       
    37 *** Sequence
    22 ** Operators in Python
    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   - int
    26 ** Float
    48   - float
    27 ** Complex
    49   - complex
       
    50 * Question 1
       
    51    - Find the absolute value of 3+4j 
       
    52 * Solution 1
       
    53   #+begin_src python
       
    54     abs(3+4j)
       
    55   #+end_src python
       
    56 * Question 2
       
    57   - What is the datatype of number 999999999999999999? Is it
       
    58 not int?
       
    59 
       
    60 * Solution 2
       
    61   - Long
       
    62   - Large integers numbers are internally stored in python as Long
       
    63     datatype.
       
    64 
    28 
    65 
    29 * Boolean
    66 * Boolean
    30 ** True
    67   #+begin_src python
    31 ** False
    68     In []: t=True
       
    69     In []: f=False
       
    70   #+end_src
       
    71 
       
    72 * Question 3
       
    73   - Using python find sqaure root of 3?
       
    74 
       
    75 * Solution 3
       
    76 
       
    77   - 3**0.5
       
    78 
       
    79 * Question 4
       
    80   - Is 3**1/2 and 3**0.5 same
       
    81 * Solution 4
       
    82   - No,One gives an int answer and the other float        
    32 
    83 
    33 * Sequence Data types
    84 * Sequence Data types
    34 ** Data in Sequence 
    85 ** Properties
    35 ** Accessed using Index
    86  - Data in Sequence 
    36 *** list
    87  - Accessed using Index
    37 *** String
    88 ** Type
    38 *** Tuple
    89  - list
       
    90  - String
       
    91  - Tuple
    39 
    92 
    40 * All are Strings
    93 * All are Strings
       
    94    #+begin_src python 
       
    95       k = 'Single quote'
       
    96       l = "Double quote contain's single quote"
       
    97       m = '''"Contain's both"'''
    41 
    98 
    42 ** k='Single quote'
    99     #+end_src 
    43 ** l="Double quote contain's single quote"
   100 * Immutabilty Error
    44 ** m='''"Contain's both"'''
   101    #+begin_src python
       
   102       In []: greeting_string[1]='k'
       
   103       -------------------------------------------------------
       
   104       TypeError           Traceback (most recent call last)
    45 
   105 
       
   106       /home/fossee/<ipython console> in <module>()
       
   107 
       
   108       TypeError: 'str' object does not support item assignment
       
   109    #+end_src 
       
   110 
       
   111 * Question 5
       
   112   Check if 3 is an element of the list [1,7,5,3,4]. In case it is
       
   113 change it to 21.
       
   114 
       
   115 * Solution 5
       
   116      #+begin_src python
       
   117         l=[1,7,5,3,4]
       
   118         3 in l
       
   119         l[3]=21
       
   120         l
       
   121      #+end_src
       
   122 * Question 6
       
   123   Convert the string ~"Elizabeth is queen of england"~ to ~"Elizabeth is
       
   124 queen"~
       
   125 
       
   126 * Solution 6
       
   127      #+begin_src python
       
   128     s = "Elizabeth is queen of england"                                                                                                                 
       
   129     stemp = s.split()                                                                                                                                   
       
   130     ' '.join(stemp[:3])                                                                                                                               
       
   131     #+end_src 
    46 * Summary 
   132 * Summary 
    47 ** a=73
   133   - Number Datatypes -- integer,float and complex 
    48 ** b=3.14
   134   - Boolean and datatype and operators
    49 ** c=3+4j
   135   - Sequence data types -- List, String and Tuple
    50 
   136   - Accesing sequence
    51 * Summary Contd.
   137   - Slicing sequences
    52 
   138   - Finding length, sorting and reversing operations on sequences
    53 ** t=True
   139   - Immutability
    54 ** f=False
   140 * Thank you!
    55 ** t and f
   141 #+begin_latex
    56 
   142   \begin{block}{}
    57 * Summary Contd.
   143   \begin{center}
    58 ** l= [2,1,4,3]
   144   This spoken tutorial has been produced by the
    59 ** s='hello'
   145   \textcolor{blue}{FOSSEE} team, which is funded by the 
    60 ** tu=(1,2,3,4)
   146   \end{center}
    61 
   147   \begin{center}
    62 * Summary Contd.
   148     \textcolor{blue}{National Mission on Education through \\
    63 ** tu[-1]
   149       Information \& Communication Technology \\ 
    64 ** s[1:-1]
   150       MHRD, Govt. of India}.
    65 
   151   \end{center}  
    66 * Summary Contd.
   152   \end{block}
    67 
   153 #+end_latex
    68 ** Sorted(l)
       
    69 ** reversed(s)
       
    70 
       
    71 * COMMENT 
       
    72 # [Puneeth: Where is the last slide?]
       
    73 # [Puneeth: Why don't you use the template slides.org?]
       
    74 
   154 
    75 
   155 
       
   156 
       
   157 
       
   158