basic-data-type/slides.org.orig
changeset 522 d33698326409
parent 521 88a01948450d
child 523 54bdda4aefa5
equal deleted inserted replaced
521:88a01948450d 522:d33698326409
     1 #+LaTeX_CLASS: beamer
       
     2 #+LaTeX_CLASS_OPTIONS: [presentation]
       
     3 #+BEAMER_FRAME_LEVEL: 1
       
     4 
       
     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)
       
     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 
       
     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}
       
    20 
       
    21 #+TITLE: Plotting Data 
       
    22 #+AUTHOR: FOSSEE
       
    23 #+DATE: 2010-09-14 Tue
       
    24 #+EMAIL: info@fossee.in
       
    25 
       
    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
       
    32 
       
    33 * Outline 
       
    34 ** Datatypes 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
       
    45 
       
    46 * Numbers
       
    47   - int
       
    48   - float
       
    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 
       
    65 
       
    66 * Boolean
       
    67   #+begin_src python
       
    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        
       
    83 
       
    84 * Sequence Data types
       
    85 ** Properties
       
    86  - Data in Sequence 
       
    87  - Accessed using Index
       
    88 ** Type
       
    89  - list
       
    90  - String
       
    91  - Tuple
       
    92 
       
    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"'''
       
    98 
       
    99     #+end_src 
       
   100 * Immutabilty Error
       
   101    #+begin_src python
       
   102       In []: greeting_string[1]='k'
       
   103       -------------------------------------------------------
       
   104       TypeError           Traceback (most recent call last)
       
   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 
       
   132 * Summary 
       
   133   - Number Datatypes -- integer,float and complex 
       
   134   - Boolean and datatype and operators
       
   135   - Sequence data types -- List, String and Tuple
       
   136   - Accesing sequence
       
   137   - Slicing sequences
       
   138   - Finding length, sorting and reversing operations on sequences
       
   139   - Immutability
       
   140 * Thank you!
       
   141 #+begin_latex
       
   142   \begin{block}{}
       
   143   \begin{center}
       
   144   This spoken tutorial has been produced by the
       
   145   \textcolor{blue}{FOSSEE} team, which is funded by the 
       
   146   \end{center}
       
   147   \begin{center}
       
   148     \textcolor{blue}{National Mission on Education through \\
       
   149       Information \& Communication Technology \\ 
       
   150       MHRD, Govt. of India}.
       
   151   \end{center}  
       
   152   \end{block}
       
   153 #+end_latex
       
   154 
       
   155 
       
   156 
       
   157 
       
   158