Python @Wheel Lab

1,427 views
1,347 views

Published on

20130627 @Wheel Lab
Talk About Python

Published in: Education, Technology
2 Comments
5 Likes
Statistics
Notes
No Downloads
Views
Total views
1,427
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
2
Likes
5
Embeds 0
No embeds

No notes for slide

Python @Wheel Lab

  1. 1. @ WheelLab 2013.06.27 Python 郭至軒(KuoE0) KuoE0.tw@gmail.com KuoE0.ch
  2. 2. Latest update: Jun 30, 2013 Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/
  3. 3. What is Python?
  4. 4. What is Python? a programming language
  5. 5. What is Python? easy to Read easy to Learn easy to Write a programming language
  6. 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
  7. 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
  8. 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
  9. 9. What does the logo mean?
  10. 10. 界 Kingdom 動物界 Animalia 門 Phylum 脊索動物門 Chordata 綱 Class 爬蟲科 Reptilia 目 Order 有鱗目 Squamata 科 Family 蟒科 Pythonidae 屬 Genus 蟒屬 Python
  11. 11. http://wallpapers.free-review.net/15__Tree_python.htm
  12. 12. http://wallpapers.free-review.net/15__Tree_python.htm
  13. 13. More About Python...
  14. 14. More About Python... Interpreted Language Do not need to compile!
  15. 15. Compiled Language compiler execute
  16. 16. Interpreted Language execute But, interpret in execution time. And, it would be slow...
  17. 17. More About Python... Object-Oriented Language Everything in Python is object!
  18. 18. number function string list Object
  19. 19. number function string list Object
  20. 20. overloading polymorphism inheritance multiple inheritance
  21. 21. More About Python... Imperative Programming Generic Programming Functional Programming
  22. 22. Philosophy
  23. 23. There should be one— and preferably only one —obvious way to do it. Philosophy
  24. 24. 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.
  25. 25. $ Zen of Python
  26. 26. $$ python -ic “” Zen of Python
  27. 27. $$ python -ic “”$ python -ic “” >>> Zen of Python
  28. 28. $$ python -ic “”$ python -ic “” >>> $ python -ic “” >>> import this Zen of Python
  29. 29. $$ 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
  30. 30. Current Situation
  31. 31. Current Situation Python 2.x Python 3.x
  32. 32. Current Situation Python 2.x Python 3.x Coexist!
  33. 33. Current Situation Python 2.x Python 3.x Coexist!
  34. 34. Current Situation Python 2.x Python 3.x Coexist! backwards-incompatible
  35. 35. 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
  36. 36. http://www.ibm.com/developerworks/cn/linux/l-python3-1/ Python 3 的新特性
  37. 37. Python 2.x
  38. 38. Python 2.x Today, Let’s Talk About
  39. 39. Environment
  40. 40. Environment For Unix-like OS User, Python 2.x is Built-in!
  41. 41. 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.
  42. 42. $ Check Version of Python
  43. 43. $ Check Version of Python $ python --version
  44. 44. $ Check Version of Python $ python --version$ python --version Python 2.7.5
  45. 45. $ Check Version of Python $ python --version$ python --version Python 2.7.5 2.7.5 is released on May 15, 2013
  46. 46. $ Check Version of Python
  47. 47. $$ python Check Version of Python
  48. 48. $$ 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
  49. 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. >>> $ 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
  50. 50. $ Interactive Shell
  51. 51. $$ python Interactive Shell
  52. 52. $$ 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
  53. 53. $$ 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
  54. 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 prompt means that your turn!
  55. 55. $ Interactive Shell
  56. 56. $$ python Interactive Shell
  57. 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. >>> Interactive Shell
  58. 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 Interactive Shell
  59. 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 >>> Interactive Shell
  60. 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” Interactive Shell
  61. 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’ >>> Interactive Shell
  62. 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 Interactive Shell
  63. 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 >>> Interactive Shell
  64. 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 Interactive Shell
  65. 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 >>> Interactive Shell
  66. 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 Interactive Shell
  67. 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 >>> Interactive Shell
  68. 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): Interactive Shell
  69. 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): ... Interactive Shell
  70. 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 Interactive Shell
  71. 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 ... Interactive Shell
  72. 72. $$ 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
  73. 73. $$ 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
  74. 74. $$ 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
  75. 75. Hello World!
  76. 76. Hello World! if __name__ == “__main__”: print “Hello World!” helloworld.py
  77. 77. $ Hello World!
  78. 78. $ Hello World! $ python helloworld.py
  79. 79. $ Hello World! $ python helloworld.py$ python helloworld.py Hello World! $
  80. 80. A Python Code
  81. 81. 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
  82. 82. 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
  83. 83. $ script language
  84. 84. $ script language $ python 9x9table.py
  85. 85. $ 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 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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 $
  86. 86. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!”
  87. 87. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!”
  88. 88. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!” and write all statements after it.
  89. 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)) variable can be used without declaration
  90. 90. 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
  91. 91. 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
  92. 92. 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
  93. 93. You can use to identify scopes.
  94. 94. You can use one space two spaces three spaces four spaces lots of spaces to identify scopes.
  95. 95. 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.
  96. 96. But, you should unify the style!
  97. 97. Built-in DataType
  98. 98. 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
  99. 99. Initialization / Conversion data type initial int int(x) long long(x) float float(x) complex complex(x) complex(x, y) >>>
  100. 100. Initialization / Conversion data type initial int int(x) long long(x) float float(x) complex complex(x) complex(x, y) >>>>>> int(10)
  101. 101. 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 >>>
  102. 102. 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”)
  103. 103. 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 >>>
  104. 104. 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)
  105. 105. 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) >>>
  106. 106. 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)
  107. 107. 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) >>>
  108. 108. 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”)
  109. 109. 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) >>>
  110. 110. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>
  111. 111. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>>>> 2**10
  112. 112. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>>>> 2**10>>> 2**10 1024 >>>
  113. 113. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>>>> 2**10>>> 2**10 1024 >>> >>> 2**10 1024 >>> 5.8 // 2
  114. 114. 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 >>>
  115. 115. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>
  116. 116. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>>>> 3 & 1
  117. 117. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>>>> 3 & 1>>> 3 & 1 1 >>>
  118. 118. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>>>> 3 & 1>>> 3 & 1 1 >>> >>> 3 & 1 1 >>> 1 << 10
  119. 119. 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 >>>
  120. 120. 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
  121. 121. 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 >>>
  122. 122. Comparison Operators > greater than >= greater than or equal to < less than <= less than or equal to == equal to != not equal to
  123. 123. List Contents are surrounded by square brackets and separate by comma. >>>
  124. 124. List Contents are surrounded by square brackets and separate by comma. >>>>>> [“aaa”, “bbb”, 1, 2]
  125. 125. List Contents are surrounded by square brackets and separate by comma. >>>>>> [“aaa”, “bbb”, 1, 2]>>> [“aaa”, “bbb”, 1, 2] [‘aaa’, ‘bbb’, 1, 2] >>>
  126. 126. Initialization / Conversion >>>
  127. 127. Initialization / Conversion >>>>>> list([1, 2, 3])
  128. 128. Initialization / Conversion >>>>>> list([1, 2, 3])>>> list([1, 2, 3]) [1, 2, 3] >>>
  129. 129. Initialization / Conversion >>>>>> list([1, 2, 3])>>> list([1, 2, 3]) [1, 2, 3] >>> >>> list([1, 2, 3]) [1, 2, 3] >>> list(“abc”)
  130. 130. 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’] >>>
  131. 131. Operators + append * repeat >>>
  132. 132. Operators + append * repeat >>>>>> x = [1, 2, 3]
  133. 133. Operators + append * repeat >>>>>> x = [1, 2, 3]>>> x = [1, 2, 3] >>>
  134. 134. Operators + append * repeat >>>>>> x = [1, 2, 3]>>> x = [1, 2, 3] >>> >>> x = [1, 2, 3] >>> y = [‘a’, ‘b’]
  135. 135. 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’] >>>
  136. 136. 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
  137. 137. 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] >>>
  138. 138. 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
  139. 139. 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’] >>>
  140. 140. >>> Access Element
  141. 141. >>>>>> x = [1, 2, 3, 4, 5] Access Element
  142. 142. >>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5] >>> Access Element
  143. 143. >>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5] >>> >>> x = [1, 2, 3, 4, 5] >>> x[1] Access Element
  144. 144. >>>>>> 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
  145. 145. >>>>>> 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
  146. 146. >>>>>> 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
  147. 147. >>>>>> 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
  148. 148. >>>>>> 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
  149. 149. >>> Slice [start:end(:step)]
  150. 150. >>> Slice [start:end(:step)] [0:length(:1)] default value
  151. 151. >>>>>> x = [1, 2, 3, 4, 5] Slice [start:end(:step)] [0:length(:1)] default value
  152. 152. >>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5] >>> Slice [start:end(:step)] [0:length(:1)] default value
  153. 153. >>>>>> 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
  154. 154. >>>>>> 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
  155. 155. >>>>>> 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
  156. 156. >>>>>> 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
  157. 157. >>>>>> 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
  158. 158. >>>>>> 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
  159. 159. >>>>>> 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
  160. 160. >>>>>> 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
  161. 161. >>>>>> 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
  162. 162. >>>>>> 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

×