Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python @NCKU_CSIE

Python @NCKU_CSIE

National Cheng Kung University
2013 Programming Language
Talk About Python

KuoE0

June 03, 2013
Tweet

More Decks by KuoE0

Other Decks in Programming

Transcript

  1. @ Programming Language 2013
    Python
    郭⾄至軒(KuoE0)
    [email protected]
    KuoE0.ch

    View full-size slide

  2. Latest update: Jan 10, 2014,
    Attribution-ShareAlike 3.0 Unported
    (CC BY-SA 3.0)
    http://creativecommons.org/licenses/by-sa/3.0/

    View full-size slide

  3. What is Python?

    View full-size slide

  4. What is Python?
    a programming language

    View full-size slide

  5. What is Python?
    easy to Read
    easy to Learn
    easy to Write
    a programming language

    View full-size slide

  6. Position
    May 2013
    Position
    May 2012
    Delta in
    Position
    Programming Language
    1 1 = C
    2 2 = Java
    3 4 ↑ Objective-C
    4 3 ↓ C++
    5 5 = C#
    6 6 = PHP
    7 7 = Visual Basic
    8 8 = Python
    9 9 = Perl
    10 11 ↑ Ruby
    http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
    Top Language in TIOBE

    View full-size slide

  7. Javascript
    Ruby
    Java
    Python
    Shell
    PHP
    C
    C++
    Perl
    Objective-C
    0% 5% 10% 15% 20% 25%
    3%
    4%
    5%
    6%
    7%
    8%
    8%
    8%
    12%
    21%
    Top Languages in Github
    https://github.com/languages

    View full-size slide

  8. Javascript
    Ruby
    Java
    Python
    Shell
    PHP
    C
    C++
    Perl
    Objective-C
    0% 5% 10% 15% 20% 25%
    3%
    4%
    5%
    6%
    7%
    8%
    8%
    8%
    12%
    21%
    Top Languages in Github
    https://github.com/languages

    View full-size slide

  9. What does the logo mean?

    View full-size slide

  10. 界 Kingdom 動物界 Animalia
    ⾨門 Phylum 脊索動物⾨門 Chordata
    綱 Class 爬蟲科 Reptilia
    ⺫⽬目 Order 有鱗⺫⽬目 Squamata
    科 Family 蟒科 Pythonidae
    屬 Genus 蟒屬 Python

    View full-size slide

  11. http://wallpapers.free-review.net/15__Tree_python.htm

    View full-size slide

  12. http://wallpapers.free-review.net/15__Tree_python.htm

    View full-size slide

  13. More About Python...

    View full-size slide

  14. More About Python...
    Interpreted Language
    Do not need to compile!

    View full-size slide

  15. Compiled Language
    compiler execute

    View full-size slide

  16. Interpreted Language
    execute
    But, interpret in execution time.
    And, it would be slow...

    View full-size slide

  17. More About Python...
    Object-Oriented Language
    Everything in Python is object!

    View full-size slide

  18. number
    function
    string
    list
    Object

    View full-size slide

  19. number
    function
    string
    list
    Object

    View full-size slide

  20. overloading
    polymorphism
    inheritance
    multiple inheritance

    View full-size slide

  21. More About Python...
    Imperative Programming
    Generic Programming
    Functional Programming

    View full-size slide

  22. There should be one—
    and preferably only one
    —obvious way to do it.
    Philosophy

    View full-size slide

  23. There should be one—
    and preferably only one
    —obvious way to do it.
    Philosophy
    There should be one—
    and preferably only one
    —obvious way to do it.

    View full-size slide

  24. $
    Zen of Python

    View full-size slide

  25. $
    $ python -ic “”
    Zen of Python

    View full-size slide

  26. $
    $ python -ic “”
    $ python -ic “”
    >>>
    Zen of Python

    View full-size slide

  27. $
    $ python -ic “”
    $ python -ic “”
    >>>
    $ python -ic “”
    >>> import this
    Zen of Python

    View full-size slide

  28. $
    $ python -ic “”
    $ python -ic “”
    >>>
    $ python -ic “”
    >>> import this
    $ python -ic “”
    >>> import this
    The Zen of Python, by Tim Peters
    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    >>> import this
    The Zen of Python, by Tim Peters
    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    The Zen of Python, by Tim Peters
    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Beautiful is better than ugly.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    Explicit is better than implicit.
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    Simple is better than complex.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    Complex is better than complicated.
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    Flat is better than nested.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Sparse is better than dense.
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    Readability counts.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Special cases aren't special enough to
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    break the rules.
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    Although practicality beats purity.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    Errors should never pass silently.
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    Unless explicitly silenced.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    In the face of ambiguity, refuse the
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    If the implementation is easy to explain,
    temptation to guess.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    If the implementation is easy to explain,
    it may be a good idea.
    There should be one-- and preferably only
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    If the implementation is easy to explain,
    it may be a good idea.
    Namespaces are one honking great idea --
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    If the implementation is easy to explain,
    it may be a good idea.
    Namespaces are one honking great idea --
    let's do more of those!
    one --obvious way to do it.
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    If the implementation is easy to explain,
    it may be a good idea.
    Namespaces are one honking great idea --
    let's do more of those!
    Although that way may not be obvious at
    first unless you're Dutch.
    Now is better than never.
    Although never is often better than *right*
    now.
    If the implementation is hard to explain,
    it's a bad idea.
    If the implementation is easy to explain,
    it may be a good idea.
    Namespaces are one honking great idea --
    let's do more of those!
    >>>
    Zen of Python

    View full-size slide

  29. Current Situation

    View full-size slide

  30. Current Situation
    Python 2.x Python 3.x

    View full-size slide

  31. Current Situation
    Python 2.x Python 3.x
    Coexist!

    View full-size slide

  32. Current Situation
    Python 2.x Python 3.x
    Coexist!

    View full-size slide

  33. Current Situation
    Python 2.x Python 3.x
    Coexist!
    backwards-incompatible

    View full-size slide

  34. Python 2.x Python 3.x
    2.7.x is the latest version under development
    more 3-party library 2to3.py
    built-in on many OS more supported unicode
    the past in someday the future in someday

    View full-size slide

  35. http://www.ibm.com/developerworks/cn/linux/l-python3-1/
    Python 3 的新特性

    View full-size slide

  36. Python 2.x
    Today, Let’s Talk About

    View full-size slide

  37. Environment
    For Unix-like OS User,
    Python 2.x is Built-in!

    View full-size slide

  38. Environment
    For Windows User,
    Download From
    http://www.python.org/download/
    if you want to launch Python in command line,
    add the path of Python binary file into PATH variable.

    View full-size slide

  39. $
    Check Version of Python

    View full-size slide

  40. $
    Check Version of Python
    $ python --version

    View full-size slide

  41. $
    Check Version of Python
    $ python --version
    $ python --version
    Python 2.7.5

    View full-size slide

  42. $
    Check Version of Python
    $ python --version
    $ python --version
    Python 2.7.5
    2.7.5 is released on May 15, 2013

    View full-size slide

  43. $
    Check Version of Python

    View full-size slide

  44. $
    $ python
    Check Version of Python

    View full-size slide

  45. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    Check Version of Python

    View full-size slide

  46. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    Check Version of Python

    View full-size slide

  47. $
    Interactive Shell

    View full-size slide

  48. $
    $ python
    Interactive Shell

    View full-size slide

  49. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    Interactive Shell

    View full-size slide

  50. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    Interactive Shell
    prompt

    View full-size slide

  51. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    Interactive Shell
    prompt
    means that your turn!

    View full-size slide

  52. $
    Interactive Shell

    View full-size slide

  53. $
    $ python
    Interactive Shell

    View full-size slide

  54. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    Interactive Shell

    View full-size slide

  55. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    Interactive Shell

    View full-size slide

  56. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    Interactive Shell

    View full-size slide

  57. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    Interactive Shell

    View full-size slide

  58. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    Interactive Shell

    View full-size slide

  59. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Interactive Shell

    View full-size slide

  60. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Interactive Shell

    View full-size slide

  61. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    Interactive Shell

    View full-size slide

  62. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    Interactive Shell

    View full-size slide

  63. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    Interactive Shell

    View full-size slide

  64. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    Interactive Shell

    View full-size slide

  65. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Interactive Shell

    View full-size slide

  66. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ...
    Interactive Shell

    View full-size slide

  67. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ...
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    Interactive Shell

    View full-size slide

  68. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ...
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    Interactive Shell

    View full-size slide

  69. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ...
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    0
    1
    2
    3
    4
    >>>
    Interactive Shell

    View full-size slide

  70. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ...
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    0
    1
    2
    3
    4
    >>>
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    0
    1
    2
    3
    4
    >>> exit()
    Interactive Shell

    View full-size slide

  71. $
    $ python
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>>
    $ python
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>>
    Python 2.7.5 (default, May 20 2013,
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>>
    23:41:46)
    [GCC 4.2.1 Compatible Apple LLVM 4.2
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>>
    (clang-425.0.28)] on darwin
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ...
    Type "help", "copyright", "credits" or
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    "license" for more information.
    >>> 1 + 2 + 3
    6
    >>> “Hello World”
    ‘Hello World’
    >>> x = 100
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    0
    1
    2
    3
    4
    >>>
    >>> y = 200
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    0
    1
    2
    3
    4
    >>> exit()
    >>> x + y
    300
    >>> for i in range(5):
    ... print i
    ...
    0
    1
    2
    3
    4
    >>> exit()
    $
    Interactive Shell

    View full-size slide

  72. Hello World!

    View full-size slide

  73. Hello World!
    if __name__ == “__main__”:
    print “Hello World!”
    helloworld.py

    View full-size slide

  74. $
    Hello World!

    View full-size slide

  75. $
    Hello World!
    $ python helloworld.py

    View full-size slide

  76. $
    Hello World!
    $ python helloworld.py
    $ python helloworld.py
    Hello World!
    $

    View full-size slide

  77. A Python Code

    View full-size slide

  78. A Python Code
    def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    9x9table.py

    View full-size slide

  79. script language
    def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    no specified entry point

    View full-size slide

  80. $
    script language

    View full-size slide

  81. $
    script language
    $ python 9x9table.py

    View full-size slide

  82. $
    script language
    $ python 9x9table.py
    $ python 9x9table.py
    2 x 1 = 2
    2 x 2 = 4
    2 x 3 = 6
    2 x 4 = 8
    2 x 5 = 10
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    2 x 1 = 2
    2 x 2 = 4
    2 x 3 = 6
    2 x 4 = 8
    2 x 5 = 10
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    2 x 2 = 4
    2 x 3 = 6
    2 x 4 = 8
    2 x 5 = 10
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    2 x 3 = 6
    2 x 4 = 8
    2 x 5 = 10
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    2 x 4 = 8
    2 x 5 = 10
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    2 x 5 = 10
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    2 x 6 = 12
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    2 x 7 = 14
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    2 x 8 = 16
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    2 x 9 = 18
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    3 x 1 = 3
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    3 x 2 = 6
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    3 x 3 = 9
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    3 x 4 = 12
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    3 x 5 = 15
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    3 x 6 = 18
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    3 x 7 = 21
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    3 x 8 = 24
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    3 x 9 = 27
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    4 x 1 = 4
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    4 x 2 = 8
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    4 x 3 = 12
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    4 x 4 = 16
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    4 x 5 = 20
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    4 x 6 = 24
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    4 x 7 = 28
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    4 x 8 = 32
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    4 x 9 = 36
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    5 x 1 = 5
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    5 x 2 = 10
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    5 x 3 = 15
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    5 x 4 = 20
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    5 x 5 = 25
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    5 x 6 = 30
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    5 x 7 = 35
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    5 x 8 = 40
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    5 x 9 = 45
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    6 x 1 = 6
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    6 x 2 = 12
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    6 x 3 = 18
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    6 x 4 = 24
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    6 x 5 = 30
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    6 x 6 = 36
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    6 x 7 = 42
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    6 x 8 = 48
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    6 x 9 = 54
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    7 x 1 = 7
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    7 x 2 = 14
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    7 x 3 = 21
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    7 x 4 = 28
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    7 x 5 = 35
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    7 x 6 = 42
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    7 x 7 = 49
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    7 x 8 = 56
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    7 x 9 = 63
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    8 x 1 = 8
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    8 x 2 = 16
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    8 x 3 = 24
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    9 x 6 = 54
    8 x 4 = 32
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    9 x 6 = 54
    9 x 7 = 63
    8 x 5 = 40
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    9 x 6 = 54
    9 x 7 = 63
    9 x 8 = 72
    8 x 6 = 48
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    9 x 6 = 54
    9 x 7 = 63
    9 x 8 = 72
    9 x 9 = 81
    8 x 7 = 56
    8 x 8 = 64
    8 x 9 = 72
    9 x 1 = 9
    9 x 2 = 18
    9 x 3 = 27
    9 x 4 = 36
    9 x 5 = 45
    9 x 6 = 54
    9 x 7 = 63
    9 x 8 = 72
    9 x 9 = 81
    $

    View full-size slide

  83. If you need a main function
    as entry point,
    if __name__ == “__main__”:
    print “Hello World!”

    View full-size slide

  84. If you need a main function
    as entry point,
    if __name__ == “__main__”:
    print “Hello World!”

    View full-size slide

  85. If you need a main function
    as entry point,
    if __name__ == “__main__”:
    print “Hello World!”
    and write all statements after it.

    View full-size slide

  86. def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    variable
    can be used without declaration

    View full-size slide

  87. def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    variable
    def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    can be used without declaration

    View full-size slide

  88. def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    scope
    use whitespace to identify scope

    View full-size slide

  89. def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    scope
    def mul(x, y):
    ret = x * y
    return ret
    for i in range(10)[2:]:
    for j in range(10)[1:]:
    print "{0} x {1} = {2}".format(i, j,
    mul(i, j))
    use whitespace to identify scope

    View full-size slide

  90. You can use
    to identify scopes.

    View full-size slide

  91. You can use
    one space
    two spaces
    three spaces
    four spaces
    lots of spaces
    to identify scopes.

    View full-size slide

  92. You can use
    one space
    two spaces
    three spaces
    four spaces
    lots of spaces
    one tab
    two tabs
    three tabs
    four tabs
    lots of tabs
    to identify scopes.

    View full-size slide

  93. But, you should unify the style!

    View full-size slide

  94. Built-in Data Type

    View full-size slide

  95. Null
    None
    >>>
    >>> None

    View full-size slide

  96. Null
    None
    >>>
    >>> None
    >>> None
    >>>

    View full-size slide

  97. Boolean
    True
    False
    >>>

    View full-size slide

  98. Boolean
    True
    False
    >>>
    >>> 1 == 1

    View full-size slide

  99. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>

    View full-size slide

  100. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1

    View full-size slide

  101. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>>

    View full-size slide

  102. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True

    View full-size slide

  103. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    True
    >>>

    View full-size slide

  104. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    True
    >>> False

    View full-size slide

  105. Boolean
    True
    False
    >>>
    >>> 1 == 1
    >>> 1 == 1
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    True
    >>>
    >>> 1 == 1
    True
    >>> 1 != 1
    False
    >>> True
    True
    >>> False
    True
    >>> 1 != 1
    False
    >>> True
    True
    >>> False
    False
    >>>

    View full-size slide

  106. Boolean
    True
    False
    >>>

    View full-size slide

  107. Boolean
    True
    False
    upper case
    >>>

    View full-size slide

  108. Boolean
    True
    False
    upper case
    >>>
    >>> true

    View full-size slide

  109. Boolean
    True
    False
    upper case
    >>>
    >>> true
    >>> true
    Traceback (most recent
    call last):
    File "", line
    1, in
    NameError: name 'true'
    is not defined
    >>>

    View full-size slide

  110. Initialization / Conversion
    True
    False
    >>>

    View full-size slide

  111. Initialization / Conversion
    True
    False
    >>>
    >>> bool(1)

    View full-size slide

  112. Initialization / Conversion
    True
    False
    >>>
    >>> bool(1)
    >>> bool(1)
    True
    >>>

    View full-size slide

  113. Initialization / Conversion
    True
    False
    >>>
    >>> bool(1)
    >>> bool(1)
    True
    >>>
    >>> bool(1)
    True
    >>> bool(True)

    View full-size slide

  114. Initialization / Conversion
    True
    False
    >>>
    >>> bool(1)
    >>> bool(1)
    True
    >>>
    >>> bool(1)
    True
    >>> bool(True)
    >>> bool(1)
    True
    >>> bool(True)
    True
    >>>

    View full-size slide

  115. Initialization / Conversion
    True
    False
    >>>
    >>> bool(1)
    >>> bool(1)
    True
    >>>
    >>> bool(1)
    True
    >>> bool(True)
    >>> bool(1)
    True
    >>> bool(True)
    True
    >>>
    >>> bool(1)
    True
    >>> bool(True)
    True
    >>> bool()

    View full-size slide

  116. Initialization / Conversion
    True
    False
    >>>
    >>> bool(1)
    >>> bool(1)
    True
    >>>
    >>> bool(1)
    True
    >>> bool(True)
    >>> bool(1)
    True
    >>> bool(True)
    True
    >>>
    >>> bool(1)
    True
    >>> bool(True)
    True
    >>> bool()
    >>> bool(1)
    True
    >>> bool(True)
    True
    >>> bool()
    False
    >>>

    View full-size slide

  117. Logical Operators
    and and
    or or
    not not
    >>>

    View full-size slide

  118. Logical Operators
    and and
    or or
    not not
    >>>
    >>> (1 == 1) and True

    View full-size slide

  119. Logical Operators
    and and
    or or
    not not
    >>>
    >>> (1 == 1) and True
    >>> (1 == 1) and True
    True
    >>>

    View full-size slide

  120. Logical Operators
    and and
    or or
    not not
    >>>
    >>> (1 == 1) and True
    >>> (1 == 1) and True
    True
    >>>
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False

    View full-size slide

  121. Logical Operators
    and and
    or or
    not not
    >>>
    >>> (1 == 1) and True
    >>> (1 == 1) and True
    True
    >>>
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    True
    >>>

    View full-size slide

  122. Logical Operators
    and and
    or or
    not not
    >>>
    >>> (1 == 1) and True
    >>> (1 == 1) and True
    True
    >>>
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    True
    >>>
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    True
    >>> not (1 == 1)

    View full-size slide

  123. Logical Operators
    and and
    or or
    not not
    >>>
    >>> (1 == 1) and True
    >>> (1 == 1) and True
    True
    >>>
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    True
    >>>
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    True
    >>> not (1 == 1)
    >>> (1 == 1) and True
    True
    >>> (1 == 1) or False
    True
    >>> not (1 == 1)
    False
    >>>

    View full-size slide

  124. Numbers
    int
    (integer)
    long
    (long integer)
    float
    (real number)
    complex
    (complex number)
    10 10L 100.0 3 + 2j
    -789 -789L -21.9 3 - 2j
    -0x111 0xFFFFFFFFF 3.20E+10 45j
    0x69 -0x12321L -2.00E-08 3e+26j

    View full-size slide

  125. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>

    View full-size slide

  126. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)

    View full-size slide

  127. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>

    View full-size slide

  128. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)

    View full-size slide

  129. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>

    View full-size slide

  130. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)

    View full-size slide

  131. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>>

    View full-size slide

  132. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)

    View full-size slide

  133. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    (10+3j)
    >>>

    View full-size slide

  134. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    (10+3j)
    >>>
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    (10+3j)
    >>> complex(“20+5j”)

    View full-size slide

  135. Initialization / Conversion
    data type initial
    int int(x)
    long long(x)
    float float(x)
    complex
    complex(x)
    complex(x, y)
    >>>
    >>> int(10)
    >>> int(10)
    10
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>>
    >>> int(10)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    (10+3j)
    >>>
    10
    >>> int(“100”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    (10+3j)
    >>> complex(“20+5j”)
    100
    >>> complex(10)
    (10+0j)
    >>> complex(10, 3)
    (10+3j)
    >>> complex(“20+5j”)
    (20+5j)
    >>>

    View full-size slide

  136. Arithmetic Operators
    + addition
    - subtraction
    * multiplication
    / division
    % modular
    ** exponential
    // floor division
    >>>

    View full-size slide

  137. Arithmetic Operators
    + addition
    - subtraction
    * multiplication
    / division
    % modular
    ** exponential
    // floor division
    >>>
    >>> 2**10

    View full-size slide

  138. Arithmetic Operators
    + addition
    - subtraction
    * multiplication
    / division
    % modular
    ** exponential
    // floor division
    >>>
    >>> 2**10
    >>> 2**10
    1024
    >>>

    View full-size slide

  139. Arithmetic Operators
    + addition
    - subtraction
    * multiplication
    / division
    % modular
    ** exponential
    // floor division
    >>>
    >>> 2**10
    >>> 2**10
    1024
    >>>
    >>> 2**10
    1024
    >>> 5.8 // 2

    View full-size slide

  140. Arithmetic Operators
    + addition
    - subtraction
    * multiplication
    / division
    % modular
    ** exponential
    // floor division
    >>>
    >>> 2**10
    >>> 2**10
    1024
    >>>
    >>> 2**10
    1024
    >>> 5.8 // 2
    >>> 2**10
    1024
    >>> 5.8 // 2
    2.0
    >>>

    View full-size slide

  141. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>

    View full-size slide

  142. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>
    >>> 3 & 1

    View full-size slide

  143. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>
    >>> 3 & 1
    >>> 3 & 1
    1
    >>>

    View full-size slide

  144. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>
    >>> 3 & 1
    >>> 3 & 1
    1
    >>>
    >>> 3 & 1
    1
    >>> 1 << 10

    View full-size slide

  145. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>
    >>> 3 & 1
    >>> 3 & 1
    1
    >>>
    >>> 3 & 1
    1
    >>> 1 << 10
    >>> 3 & 1
    1
    >>> 1 << 10
    1024
    >>>

    View full-size slide

  146. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>
    >>> 3 & 1
    >>> 3 & 1
    1
    >>>
    >>> 3 & 1
    1
    >>> 1 << 10
    >>> 3 & 1
    1
    >>> 1 << 10
    1024
    >>>
    >>> 3 & 1
    1
    >>> 1 << 10
    1024
    >>> ~0

    View full-size slide

  147. Bitwise Operators
    & and
    | or
    ^ exclusion or
    >> shift right
    << shift left
    ~ not
    >>>
    >>> 3 & 1
    >>> 3 & 1
    1
    >>>
    >>> 3 & 1
    1
    >>> 1 << 10
    >>> 3 & 1
    1
    >>> 1 << 10
    1024
    >>>
    >>> 3 & 1
    1
    >>> 1 << 10
    1024
    >>> ~0
    >>> 3 & 1
    1
    >>> 1 << 10
    1024
    >>> ~0
    -1
    >>>

    View full-size slide

  148. Comparison Operators
    > greater than
    >= greater than or equal to
    < less than
    <= less than or equal to
    == equal to
    != not equal to

    View full-size slide

  149. String
    Contents are
    surrounded by
    single quote or
    double quote.
    >>>

    View full-size slide

  150. String
    Contents are
    surrounded by
    single quote or
    double quote.
    >>>
    >>> “Hello World”

    View full-size slide

  151. String
    Contents are
    surrounded by
    single quote or
    double quote.
    >>>
    >>> “Hello World”
    >>> “Hello World”
    ‘Hello World’
    >>>

    View full-size slide

  152. String
    Contents are
    surrounded by
    single quote or
    double quote.
    >>>
    >>> “Hello World”
    >>> “Hello World”
    ‘Hello World’
    >>>
    >>> “Hello World!”
    ‘Hello World’
    >>> ‘Hello World!’

    View full-size slide

  153. String
    Contents are
    surrounded by
    single quote or
    double quote.
    >>>
    >>> “Hello World”
    >>> “Hello World”
    ‘Hello World’
    >>>
    >>> “Hello World!”
    ‘Hello World’
    >>> ‘Hello World!’
    >>> “Hello World!”
    ‘Hello World’
    >>> ‘Hello World!’
    ‘Hello World’
    >>>

    View full-size slide

  154. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>

    View full-size slide

  155. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello

    View full-size slide

  156. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...

    View full-size slide

  157. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””

    View full-size slide

  158. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>

    View full-size slide

  159. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello

    View full-size slide

  160. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ...

    View full-size slide

  161. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ...
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””

    View full-size slide

  162. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ...
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>>

    View full-size slide

  163. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ...
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>> print x

    View full-size slide

  164. Cross-line String
    Contents are
    surrounded by
    three single
    quotes or three
    double quotes.
    >>>
    >>> “““Hello
    >>> “““Hello
    ...
    >>> “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ...
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>>
    >>> “““Hello
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>> print x
    ... World!”””
    ‘Hello\nWorld!’
    >>> x = “““Hello
    ... World!”””
    >>> print x
    Hello
    World!
    >>>

    View full-size slide

  165. Initialization / Conversion
    >>>

    View full-size slide

  166. Initialization / Conversion
    >>>
    >>> str(“I’m string”)

    View full-size slide

  167. Initialization / Conversion
    >>>
    >>> str(“I’m string”)
    >>> str(“I’m string”)
    “I’m string”
    >>>

    View full-size slide

  168. Initialization / Conversion
    >>>
    >>> str(“I’m string”)
    >>> str(“I’m string”)
    “I’m string”
    >>>
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)

    View full-size slide

  169. Initialization / Conversion
    >>>
    >>> str(“I’m string”)
    >>> str(“I’m string”)
    “I’m string”
    >>>
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    ‘100’
    >>>

    View full-size slide

  170. Initialization / Conversion
    >>>
    >>> str(“I’m string”)
    >>> str(“I’m string”)
    “I’m string”
    >>>
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    ‘100’
    >>>
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    ‘100’
    >>> str(complex(10, 3))

    View full-size slide

  171. Initialization / Conversion
    >>>
    >>> str(“I’m string”)
    >>> str(“I’m string”)
    “I’m string”
    >>>
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    ‘100’
    >>>
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    ‘100’
    >>> str(complex(10, 3))
    >>> str(“I’m string”)
    “I’m string”
    >>> str(100)
    ‘100’
    >>> str(complex(10, 3))
    ‘(10+3j)’
    >>>

    View full-size slide

  172. >>>
    Operators
    + concatenate
    * repeat

    View full-size slide

  173. >>>
    >>> x = “abc”
    Operators
    + concatenate
    * repeat

    View full-size slide

  174. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    Operators
    + concatenate
    * repeat

    View full-size slide

  175. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    Operators
    + concatenate
    * repeat

    View full-size slide

  176. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    Operators
    + concatenate
    * repeat

    View full-size slide

  177. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    Operators
    + concatenate
    * repeat

    View full-size slide

  178. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>>
    Operators
    + concatenate
    * repeat

    View full-size slide

  179. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    Operators
    + concatenate
    * repeat

    View full-size slide

  180. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    >>> x = ‘abc’
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    ‘(abcabcabc)’
    >>>
    Operators
    + concatenate
    * repeat

    View full-size slide

  181. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    >>> x = ‘abc’
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    ‘(abcabcabc)’
    >>>
    >>> x = ‘abc’
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    ‘(abcabcabc)’
    >>> (x + ‘d’) * 3
    Operators
    + concatenate
    * repeat

    View full-size slide

  182. >>>
    >>> x = “abc”
    >>> x = “abc”
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>>
    >>> x = “abc”
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    >>> x = ‘abc’
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    ‘(abcabcabc)’
    >>>
    >>> x = ‘abc’
    >>> ‘(’ + x + ‘)’
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    ‘(abcabcabc)’
    >>> (x + ‘d’) * 3
    ‘(abc)’
    >>> x * 3
    ‘abcabcabc’
    >>> ‘(’ + x * 3 + ‘)’
    ‘(abcabcabc)’
    >>> (x + ‘d’) * 3
    ‘abcdabcdabcd’
    >>>
    Operators
    + concatenate
    * repeat

    View full-size slide

  183. >>>
    Access Character

    View full-size slide

  184. >>>
    >>> x = ‘0123456789’
    Access Character

    View full-size slide

  185. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    Access Character

    View full-size slide

  186. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    Access Character

    View full-size slide

  187. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>>
    Access Character

    View full-size slide

  188. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    Access Character

    View full-size slide

  189. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>>
    Access Character

    View full-size slide

  190. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>> x
    Access Character

    View full-size slide

  191. >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>>
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>> x
    >>> x = ‘0123456789’
    >>> x[1]
    ‘1’
    >>> x[1] = ‘0’
    >>> x
    ‘0023456789’
    >>>
    Access Character

    View full-size slide

  192. >>>
    substring
    [start:end(:step)]

    View full-size slide

  193. >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  194. >>>
    >>> x = “0123456789”
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  195. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  196. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  197. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  198. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  199. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  200. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  201. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  202. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  203. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  204. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>>
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  205. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>>
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘02468’
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  206. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>>
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘02468’
    >>>
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘02468’
    >>> x[::-1]
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  207. >>>
    >>> x = “0123456789”
    >>> x = “0123456789”
    >>>
    >>> x = “0123456789”
    >>> x[::]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>>
    >>> x = “0123456789”
    >>> x[::]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>>
    ‘0123456789’
    >>> x[:]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘02468’
    >>>
    ‘0123456789’
    >>> x[1:4]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘02468’
    >>> x[::-1]
    ‘123’
    >>> x[1:-1]
    ‘12345678’
    >>> x[::2]
    ‘02468’
    >>> x[::-1]
    ‘9876543210’
    >>>
    substring
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  208. length of string
    len(string)
    >>>

    View full-size slide

  209. length of string
    len(string)
    >>>
    >>> x = ‘0123456789’

    View full-size slide

  210. length of string
    len(string)
    >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>

    View full-size slide

  211. length of string
    len(string)
    >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> len(x)

    View full-size slide

  212. length of string
    len(string)
    >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> len(x)
    >>> x = ‘0123456789’
    >>> len(x)
    10
    >>>

    View full-size slide

  213. length of string
    len(string)
    >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> len(x)
    >>> x = ‘0123456789’
    >>> len(x)
    10
    >>>
    >>> x = ‘0123456789’
    >>> len(x)
    10
    >>> len(x[::2])

    View full-size slide

  214. length of string
    len(string)
    >>>
    >>> x = ‘0123456789’
    >>> x = ‘0123456789’
    >>>
    >>> x = ‘0123456789’
    >>> len(x)
    >>> x = ‘0123456789’
    >>> len(x)
    10
    >>>
    >>> x = ‘0123456789’
    >>> len(x)
    10
    >>> len(x[::2])
    >>> x = ‘0123456789’
    >>> len(x)
    10
    >>> len(x[::2])
    5
    >>>

    View full-size slide

  215. List
    Contents are
    surrounded by
    square brackets
    and separate by
    comma.
    >>>

    View full-size slide

  216. List
    Contents are
    surrounded by
    square brackets
    and separate by
    comma.
    >>>
    >>> [“aaa”, “bbb”, 1, 2]

    View full-size slide

  217. List
    Contents are
    surrounded by
    square brackets
    and separate by
    comma.
    >>>
    >>> [“aaa”, “bbb”, 1, 2]
    >>> [“aaa”, “bbb”, 1, 2]
    [‘aaa’, ‘bbb’, 1, 2]
    >>>

    View full-size slide

  218. Initialization / Conversion
    >>>

    View full-size slide

  219. Initialization / Conversion
    >>>
    >>> list([1, 2, 3])

    View full-size slide

  220. Initialization / Conversion
    >>>
    >>> list([1, 2, 3])
    >>> list([1, 2, 3])
    [1, 2, 3]
    >>>

    View full-size slide

  221. Initialization / Conversion
    >>>
    >>> list([1, 2, 3])
    >>> list([1, 2, 3])
    [1, 2, 3]
    >>>
    >>> list([1, 2, 3])
    [1, 2, 3]
    >>> list(“abc”)

    View full-size slide

  222. Initialization / Conversion
    >>>
    >>> list([1, 2, 3])
    >>> list([1, 2, 3])
    [1, 2, 3]
    >>>
    >>> list([1, 2, 3])
    [1, 2, 3]
    >>> list(“abc”)
    >>> list([1, 2, 3])
    [1, 2, 3]
    >>> list(“abc”)
    [‘a’, ‘b’, ‘c’]
    >>>

    View full-size slide

  223. Operators
    + append
    * repeat
    >>>

    View full-size slide

  224. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]

    View full-size slide

  225. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>

    View full-size slide

  226. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]

    View full-size slide

  227. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>>

    View full-size slide

  228. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2

    View full-size slide

  229. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    [1, 2, 3, 1, 2, 3]
    >>>

    View full-size slide

  230. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    [1, 2, 3, 1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    [1, 2, 3, 1, 2, 3]
    >>> x + y

    View full-size slide

  231. Operators
    + append
    * repeat
    >>>
    >>> x = [1, 2, 3]
    >>> x = [1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    [1, 2, 3, 1, 2, 3]
    >>>
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    [1, 2, 3, 1, 2, 3]
    >>> x + y
    >>> x = [1, 2, 3]
    >>> y = [‘a’, ‘b’]
    >>> x * 2
    [1, 2, 3, 1, 2, 3]
    >>> x + y
    [1, 2, 3, ‘a’, ‘b’]
    >>>

    View full-size slide

  232. >>>
    Access Element

    View full-size slide

  233. >>>
    >>> x = [1, 2, 3, 4, 5]
    Access Element

    View full-size slide

  234. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    Access Element

    View full-size slide

  235. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    Access Element

    View full-size slide

  236. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>>
    Access Element

    View full-size slide

  237. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    Access Element

    View full-size slide

  238. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>>
    Access Element

    View full-size slide

  239. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>> x
    Access Element

    View full-size slide

  240. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>> x
    >>> x = [1, 2, 3, 4, 5]
    >>> x[1]
    2
    >>> x[1] = ‘0’
    >>> x
    [1, ‘0’, 3, 4, 5]
    >>>
    Access Element

    View full-size slide

  241. >>>
    Slice
    [start:end(:step)]

    View full-size slide

  242. >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  243. >>>
    >>> x = [1, 2, 3, 4, 5]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  244. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  245. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  246. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  247. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  248. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  249. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  250. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  251. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  252. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  253. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>>
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  254. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>>
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 3, 5]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  255. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>>
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 3, 5]
    >>>
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 3, 5]
    >>> x[::-1]
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  256. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x[::]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>>
    [1, 2, 3, 4, 5]
    >>> x[:]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 3, 5]
    >>>
    [1, 2, 3, 4, 5]
    >>> x[1:3]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 3, 5]
    >>> x[::-1]
    [2, 3]
    >>> x[1:-1]
    [2, 3, 4]
    >>> x[::2]
    [1, 3, 5]
    >>> x[::-1]
    [5, 4, 3, 2, 1]
    >>>
    Slice
    [start:end(:step)]
    [0:length(:1)]
    default value

    View full-size slide

  257. >>>
    length of list
    len(list)

    View full-size slide

  258. >>>
    >>> x = [1, 2, 3, 4, 5]
    length of list
    len(list)

    View full-size slide

  259. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    length of list
    len(list)

    View full-size slide

  260. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    length of list
    len(list)

    View full-size slide

  261. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    5
    >>>
    length of list
    len(list)

    View full-size slide

  262. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    5
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    5
    >>> len(x[::2])
    length of list
    len(list)

    View full-size slide

  263. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    5
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    5
    >>> len(x[::2])
    >>> x = [1, 2, 3, 4, 5]
    >>> len(x)
    5
    >>> len(x[::2])
    3
    >>>
    length of list
    len(list)

    View full-size slide

  264. Tuple
    Immutable List
    >>>

    View full-size slide

  265. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)

    View full-size slide

  266. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>

    View full-size slide

  267. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2

    View full-size slide

  268. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>>

    View full-size slide

  269. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)

    View full-size slide

  270. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>>

    View full-size slide

  271. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> x[1] = 3

    View full-size slide

  272. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> x[1] = 3
    >>> x[1] = 3
    Traceback (most recent
    call last):
    File "", line
    1, in
    TypeError: 'tuple'
    object does not support
    item assignment

    View full-size slide

  273. Tuple
    Immutable List
    >>>
    >>> (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>>
    >>> (1, ‘aaa’, 2)
    (1, ‘aaa’, 2)
    >>> 1, ‘aaa’, 2
    (1, ‘aaa’, 2)
    >>> x = (1, ‘aaa’, 2)
    >>> x[1] = 3
    >>> x[1] = 3
    Traceback (most recent
    call last):
    File "", line
    1, in
    TypeError: 'tuple'
    object does not support
    item assignment
    Traceback (most recent
    call last):
    File "", line
    1, in
    TypeError: 'tuple'
    object does not support
    item assignment
    >>>

    View full-size slide

  274. >>>
    Initialization / Conversion

    View full-size slide

  275. >>>
    >>> tuple([1, 2, 3])
    Initialization / Conversion

    View full-size slide

  276. >>>
    >>> tuple([1, 2, 3])
    >>> tuple([1, 2, 3])
    (1, 2, 3)
    >>>
    Initialization / Conversion

    View full-size slide

  277. >>>
    Access Element

    View full-size slide

  278. >>>
    >>> x = (1, 2, 3)
    Access Element

    View full-size slide

  279. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>

    View full-size slide

  280. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]

    View full-size slide

  281. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>

    View full-size slide

  282. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x

    View full-size slide

  283. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>

    View full-size slide

  284. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a

    View full-size slide

  285. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>>

    View full-size slide

  286. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b

    View full-size slide

  287. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    2
    >>>

    View full-size slide

  288. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    2
    >>>
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    2
    >>> c

    View full-size slide

  289. >>>
    >>> x = (1, 2, 3)
    Access Element
    >>> x = (1, 2, 3)
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>>
    >>> x = (1, 2, 3)
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    2
    >>>
    >>> x[1]
    2
    >>> a, b, c = x
    >>> a
    1
    >>> b
    2
    >>> c
    >>> a, b, c = x
    >>> a
    1
    >>> b
    2
    >>> c
    3
    >>>

    View full-size slide

  290. >>>
    length of tuple
    len(tuple)

    View full-size slide

  291. >>>
    >>> x = 1, 2, 3, 4, 5
    length of tuple
    len(tuple)

    View full-size slide

  292. >>>
    >>> x = 1, 2, 3, 4, 5
    >>> x = 1, 2, 3, 4, 5
    >>>
    length of tuple
    len(tuple)

    View full-size slide

  293. >>>
    >>> x = 1, 2, 3, 4, 5
    >>> x = 1, 2, 3, 4, 5
    >>>
    >>> x = 1, 2, 3, 4, 5
    >>> len(x)
    length of tuple
    len(tuple)

    View full-size slide

  294. >>>
    >>> x = 1, 2, 3, 4, 5
    >>> x = 1, 2, 3, 4, 5
    >>>
    >>> x = 1, 2, 3, 4, 5
    >>> len(x)
    >>> x = 1, 2, 3, 4, 5
    >>> len(x)
    5
    >>>
    length of tuple
    len(tuple)

    View full-size slide

  295. Dictionary
    >>>
    key-value relation
    key value

    View full-size slide

  296. Dictionary
    >>>
    key-value relation
    key value

    View full-size slide

  297. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()

    View full-size slide

  298. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>

    View full-size slide

  299. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123

    View full-size slide

  300. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>

    View full-size slide

  301. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’

    View full-size slide

  302. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>>

    View full-size slide

  303. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x

    View full-size slide

  304. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    {‘abc’: 123, 111: ‘aaa’}
    >>>

    View full-size slide

  305. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    {‘abc’: 123, 111: ‘aaa’}
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    {‘abc’: 123, 111: ‘aaa’}
    >>> {1: 20, 2: 30}

    View full-size slide

  306. Dictionary
    >>>
    key-value relation
    key value
    >>> x = dict()
    >>> x = dict()
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    {‘abc’: 123, 111: ‘aaa’}
    >>>
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    {‘abc’: 123, 111: ‘aaa’}
    >>> {1: 20, 2: 30}
    >>> x = dict()
    >>> x[‘abc’] = 123
    >>> x[111] = ‘aaa’
    >>> x
    {‘abc’: 123, 111: ‘aaa’}
    >>> {1: 20, 2: 30}
    {1: 20, 2: 30}
    >>>

    View full-size slide

  307. Initialization / Conversion
    >>>

    View full-size slide

  308. Initialization / Conversion
    >>>
    >>> dict()

    View full-size slide

  309. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>

    View full-size slide

  310. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)

    View full-size slide

  311. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>>

    View full-size slide

  312. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])

    View full-size slide

  313. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>>

    View full-size slide

  314. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    ‘two’: 2})

    View full-size slide

  315. Initialization / Conversion
    >>>
    >>> dict()
    >>> dict()
    {}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>>
    >>> dict()
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    {}
    >>> dict(one=1, two=2)
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    ‘two’: 2})
    {‘one’: 1, ‘two’: 2}
    >>> dict([('two', 2),
    (‘one’: 1)])
    {‘one’: 1, ‘two’: 2}
    >>> dict({‘one’: 1,
    ‘two’: 2})
    {‘one’: 1, ‘two’: 2}
    >>>

    View full-size slide

  316. >>>
    number of dictionary
    len(dict)

    View full-size slide

  317. >>>
    >>> x = {‘one’: 1,
    number of dictionary
    len(dict)
    >>> x = {‘one’: 1,
    ‘two’: 2}

    View full-size slide

  318. >>>
    >>> x = {‘one’: 1,
    number of dictionary
    len(dict)
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>>

    View full-size slide

  319. >>>
    >>> x = {‘one’: 1,
    number of dictionary
    len(dict)
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>>
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>> len(x)

    View full-size slide

  320. >>>
    >>> x = {‘one’: 1,
    number of dictionary
    len(dict)
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>>
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>> len(x)
    >>> x = {‘one’: 1,
    ‘two’: 2}
    >>> len(x)
    2
    >>>

    View full-size slide

  321. Condition
    >>>

    View full-size slide

  322. Condition
    >>>
    >>> x = 100

    View full-size slide

  323. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>

    View full-size slide

  324. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:

    View full-size slide

  325. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...

    View full-size slide

  326. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10

    View full-size slide

  327. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...

    View full-size slide

  328. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:

    View full-size slide

  329. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...

    View full-size slide

  330. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10

    View full-size slide

  331. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...

    View full-size slide

  332. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:

    View full-size slide

  333. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...

    View full-size slide

  334. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0

    View full-size slide

  335. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...

    View full-size slide

  336. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>>

    View full-size slide

  337. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x

    View full-size slide

  338. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>

    View full-size slide

  339. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>

    View full-size slide

  340. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>
    else if

    View full-size slide

  341. Condition
    >>>
    >>> x = 100
    >>> x = 100
    >>>
    >>> x = 100
    >>> if x > 100:
    >>> x = 100
    >>> if x > 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>
    >>> x = 100
    >>> if x > 100:
    ... x = x + 10
    ... elif x < 100:
    ... x = x - 10
    ... else:
    ... x = 0
    ...
    >>> x
    0
    >>>
    else if
    no switch statement in Python

    View full-size slide

  342. >>>
    >>> i = 0
    Loop

    View full-size slide

  343. >>>
    >>> i = 0
    >>> i = 0
    >>>
    Loop

    View full-size slide

  344. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    Loop

    View full-size slide

  345. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    Loop

    View full-size slide

  346. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    Loop

    View full-size slide

  347. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ...
    Loop

    View full-size slide

  348. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    Loop

    View full-size slide

  349. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    ...
    Loop

    View full-size slide

  350. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    ...
    1
    2
    3
    >>>
    Loop

    View full-size slide

  351. >>>
    >>> i = 0
    >>> i = 0
    >>>
    >>> i = 0
    >>> while i < 3:
    >>> i = 0
    >>> while i < 3:
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    ...
    >>> i = 0
    >>> while i < 3:
    ... i = i + 1
    ... print i
    ...
    1
    2
    3
    >>>
    no do-while statement in Python
    Loop

    View full-size slide

  352. >>>
    Traversal Sequence

    View full-size slide

  353. >>>
    >>> x = [1, 2, 3, 4, 5]
    Traversal Sequence

    View full-size slide

  354. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    Traversal Sequence

    View full-size slide

  355. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    Traversal Sequence

    View full-size slide

  356. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ...
    Traversal Sequence

    View full-size slide

  357. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    Traversal Sequence

    View full-size slide

  358. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    Traversal Sequence

    View full-size slide

  359. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    1
    2
    3
    4
    5
    >>>
    Traversal Sequence

    View full-size slide

  360. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    1
    2
    3
    4
    5
    >>>
    Traversal Sequence
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    1
    2
    3
    4
    5
    >>>

    View full-size slide

  361. >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> x = [1, 2, 3, 4, 5]
    >>>
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    1
    2
    3
    4
    5
    >>>
    Traversal Sequence
    >>> x = [1, 2, 3, 4, 5]
    >>> for i in x:
    ... print i
    ...
    1
    2
    3
    4
    5
    >>>
    must be a iterable object

    View full-size slide

  362. >>>
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  363. >>>
    >>> for i in range(5):
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  364. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  365. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  366. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  367. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  368. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ...
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  369. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ... print i
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  370. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ... print i
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ... print i
    ...
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  371. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ... print i
    >>> for i in range(5):
    ... if i == 2:
    ... continue
    ... print i
    ...
    ... if i == 2:
    ... continue
    ... print i
    ...
    0
    1
    3
    4
    >>>
    Addition for Loop
    continue
    skip remaining statement and
    continue loop

    View full-size slide

  372. >>>
    Addition for Loop
    break exit from loop

    View full-size slide

  373. >>>
    >>> for i in range(5):
    Addition for Loop
    break exit from loop

    View full-size slide

  374. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    Addition for Loop
    break exit from loop

    View full-size slide

  375. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    Addition for Loop
    break exit from loop

    View full-size slide

  376. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    Addition for Loop
    break exit from loop

    View full-size slide

  377. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    Addition for Loop
    break exit from loop

    View full-size slide

  378. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ...
    Addition for Loop
    break exit from loop

    View full-size slide

  379. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ... print i
    Addition for Loop
    break exit from loop

    View full-size slide

  380. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ... print i
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ... print i
    ...
    Addition for Loop
    break exit from loop

    View full-size slide

  381. >>>
    >>> for i in range(5):
    >>> for i in range(5):
    ...
    >>> for i in range(5):
    ... if i == 2:
    >>> for i in range(5):
    ... if i == 2:
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ... print i
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ... print i
    ...
    >>> for i in range(5):
    ... if i == 2:
    ... break
    ... print i
    ...
    0
    1
    >>>
    Addition for Loop
    break exit from loop

    View full-size slide

  382. >>>
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  383. >>>
    >>> for i in range(3):
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  384. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  385. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  386. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    >>> for i in range(3):
    ... print i
    ...
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  387. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    >>> for i in range(3):
    ... print i
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  388. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    >>> for i in range(3):
    ... print i
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    >>> for i in range(3):
    ... print i
    ... else:
    ...
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  389. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    >>> for i in range(3):
    ... print i
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    >>> for i in range(3):
    ... print i
    ... else:
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    ... print “done”
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  390. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    >>> for i in range(3):
    ... print i
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    >>> for i in range(3):
    ... print i
    ... else:
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    ... print “done”
    >>> for i in range(3):
    ... print i
    ... else:
    ... print “done”
    ...
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  391. >>>
    >>> for i in range(3):
    >>> for i in range(3):
    ...
    >>> for i in range(3):
    ... print i
    >>> for i in range(3):
    ... print i
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    >>> for i in range(3):
    ... print i
    ... else:
    ...
    >>> for i in range(3):
    ... print i
    ... else:
    ... print “done”
    >>> for i in range(3):
    ... print i
    ... else:
    ... print “done”
    ...
    ... print i
    ... else:
    ... print “done”
    ...
    0
    1
    2
    done
    >>>
    Addition for Loop
    else
    do something after unbroken
    loop

    View full-size slide

  392. Standard I/O

    View full-size slide

  393. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>

    View full-size slide

  394. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()

    View full-size slide

  395. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1

    View full-size slide

  396. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>

    View full-size slide

  397. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()

    View full-size slide

  398. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2

    View full-size slide

  399. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>

    View full-size slide

  400. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()

    View full-size slide

  401. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2

    View full-size slide

  402. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>

    View full-size slide

  403. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()

    View full-size slide

  404. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”

    View full-size slide

  405. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>

    View full-size slide

  406. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()

    View full-size slide

  407. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]

    View full-size slide

  408. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>>

    View full-size slide

  409. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>>
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()

    View full-size slide

  410. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>>
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()
    1 2

    View full-size slide

  411. Evaluated Input
    input
    read a string can be evaluated
    return an evaluated object
    >>>
    >>> input()
    >>> input()
    1
    >>> input()
    1
    1
    >>>
    >>> input()
    1
    1
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>>
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    >>> input()
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>>
    1
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    1
    >>> input()
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>>
    1 + 2
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    3
    >>> input()
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>>
    5.0 / 2
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()
    2.5
    >>> input()
    “aaa bbb”
    ‘aaa bbb’
    >>> input()
    [1, 2, 3]
    [1, 2, 3]
    >>> input()
    1 2
    >>> input()
    1 2
    Traceback (most recent call last):
    File "", line 1, in
    File "", line 1
    1 2
    ^
    SyntaxError: unexpected EOF while parsing
    >>>

    View full-size slide

  412. >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  413. >>>
    >>> raw_input()
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  414. >>>
    >>> raw_input()
    >>> raw_input()
    1
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  415. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  416. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  417. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  418. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  419. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  420. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  421. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  422. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  423. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  424. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  425. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  426. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  427. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  428. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>>
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  429. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>>
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    1 2
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  430. >>>
    >>> raw_input()
    >>> raw_input()
    1
    >>> raw_input()
    1
    ‘1’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>>
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    >>> raw_input()
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>>
    1
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    ‘1’
    >>> raw_input()
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>>
    1 + 2
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    ‘1 + 2’
    >>> raw_input()
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>>
    5.0 / 2
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    ‘5.0 / 2’
    >>> raw_input()
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    1 2
    “aaa bbb”
    ‘“aaa bbb”’
    >>> raw_input()
    [1, 2, 3]
    ‘[1, 2, 3]’
    >>> raw_input()
    1 2
    ‘1 2’
    >>>
    Raw Input
    raw_input()
    read a string
    return a string

    View full-size slide

  431. Output
    print print object to standard output
    >>>

    View full-size slide

  432. Output
    print print object to standard output
    >>>
    >>> print “Hello World!”

    View full-size slide

  433. Output
    print print object to standard output
    >>>
    >>> print “Hello World!”
    >>> print “Hello World!”
    Hello World!
    >>>

    View full-size slide

  434. Output
    print print object to standard output
    >>>
    >>> print “Hello World!”
    >>> print “Hello World!”
    Hello World!
    >>>
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”

    View full-size slide

  435. Output
    print print object to standard output
    >>>
    >>> print “Hello World!”
    >>> print “Hello World!”
    Hello World!
    >>>
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    Hello World!
    >>>

    View full-size slide

  436. Output
    print print object to standard output
    >>>
    >>> print “Hello World!”
    >>> print “Hello World!”
    Hello World!
    >>>
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    Hello World!
    >>>
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    Hello World!
    >>> print 1 + 2

    View full-size slide

  437. Output
    print print object to standard output
    >>>
    >>> print “Hello World!”
    >>> print “Hello World!”
    Hello World!
    >>>
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    Hello World!
    >>>
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    Hello World!
    >>> print 1 + 2
    >>> print “Hello World!”
    Hello World!
    >>> print “Hello”, “World!”
    Hello World!
    >>> print 1 + 2
    3
    >>>

    View full-size slide