SlideShare a Scribd company logo
1 of 273
@ WheelLab 2013.06.27
Python
郭至軒(KuoE0)
KuoE0.tw@gmail.com
KuoE0.ch
Latest update: Jun 30, 2013
Attribution-ShareAlike 3.0 Unported
(CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
What is Python?
What is Python?
a programming language
What is Python?
easy to Read
easy to Learn
easy to Write
a programming language
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
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
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
What does the logo mean?
界 Kingdom 動物界 Animalia
門 Phylum 脊索動物門 Chordata
綱 Class 爬蟲科 Reptilia
目 Order 有鱗目 Squamata
科 Family 蟒科 Pythonidae
屬 Genus 蟒屬 Python
http://wallpapers.free-review.net/15__Tree_python.htm
http://wallpapers.free-review.net/15__Tree_python.htm
More About Python...
More About Python...
Interpreted Language
Do not need to compile!
Compiled Language
compiler execute
Interpreted Language
execute
But, interpret in execution time.
And, it would be slow...
More About Python...
Object-Oriented Language
Everything in Python is object!
number
function
string
list
Object
number
function
string
list
Object
overloading
polymorphism
inheritance
multiple inheritance
More About Python...
Imperative Programming
Generic Programming
Functional Programming
Philosophy
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.
Philosophy
There should be one—
and preferably only one
—obvious way to do it.
$
Zen of Python
$$ python -ic “”
Zen of Python
$$ python -ic “”$ python -ic “”
>>>
Zen of Python
$$ python -ic “”$ python -ic “”
>>>
$ python -ic “”
>>> import this
Zen of Python
$$ 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
Current Situation
Current Situation
Python 2.x Python 3.x
Current Situation
Python 2.x Python 3.x
Coexist!
Current Situation
Python 2.x Python 3.x
Coexist!
Current Situation
Python 2.x Python 3.x
Coexist!
backwards-incompatible
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
http://www.ibm.com/developerworks/cn/linux/l-python3-1/
Python 3 的新特性
Python 2.x
Python 2.x
Today, Let’s Talk About
Environment
Environment
For Unix-like OS User,
Python 2.x is Built-in!
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.
$
Check Version of Python
$
Check Version of Python
$ python --version
$
Check Version of Python
$ python --version$ python --version
Python 2.7.5
$
Check Version of Python
$ python --version$ python --version
Python 2.7.5
2.7.5 is released on May 15, 2013
$
Check Version of Python
$$ python
Check Version of Python
$$ 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
$$ 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
$
Interactive Shell
$$ python
Interactive Shell
$$ 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
$$ 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
$$ 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!
$
Interactive Shell
$$ python
Interactive Shell
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
$$ 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
Hello World!
Hello World!
if __name__ == “__main__”:
print “Hello World!”
helloworld.py
$
Hello World!
$
Hello World!
$ python helloworld.py
$
Hello World!
$ python helloworld.py$ python helloworld.py
Hello World!
$
A Python Code
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
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
$
script language
$
script language
$ python 9x9table.py
$
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 =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 = 36
9 x 5 = 45
9 x 6 = 54
9 x 7 = 63
9 x 8 = 72
9 x 9 = 81
$
If you need a main function
as entry point,
if __name__ == “__main__”:
print “Hello World!”
If you need a main function
as entry point,
if __name__ == “__main__”:
print “Hello World!”
If you need a main function
as entry point,
if __name__ == “__main__”:
print “Hello World!”
and write all statements after it.
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
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
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
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
You can use
to identify scopes.
You can use
one space
two spaces
three spaces
four spaces
lots of spaces
to identify scopes.
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.
But, you should unify the style!
Built-in DataType
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
Initialization / Conversion
data type initial
int int(x)
long long(x)
float float(x)
complex
complex(x)
complex(x, y)
>>>
Initialization / Conversion
data type initial
int int(x)
long long(x)
float float(x)
complex
complex(x)
complex(x, y)
>>>>>> int(10)
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
>>>
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”)
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
>>>
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)
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)
>>>
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)
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)
>>>
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”)
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)
>>>
Arithmetic Operators
+ addition
- subtraction
* multiplication
/ division
% modular
** exponential
// floor division
>>>
Arithmetic Operators
+ addition
- subtraction
* multiplication
/ division
% modular
** exponential
// floor division
>>>>>> 2**10
Arithmetic Operators
+ addition
- subtraction
* multiplication
/ division
% modular
** exponential
// floor division
>>>>>> 2**10>>> 2**10
1024
>>>
Arithmetic Operators
+ addition
- subtraction
* multiplication
/ division
% modular
** exponential
// floor division
>>>>>> 2**10>>> 2**10
1024
>>>
>>> 2**10
1024
>>> 5.8 // 2
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
>>>
Bitwise Operators
& and
| or
^ exclusion or
>> shift right
<< shift left
~ not
>>>
Bitwise Operators
& and
| or
^ exclusion or
>> shift right
<< shift left
~ not
>>>>>> 3 & 1
Bitwise Operators
& and
| or
^ exclusion or
>> shift right
<< shift left
~ not
>>>>>> 3 & 1>>> 3 & 1
1
>>>
Bitwise Operators
& and
| or
^ exclusion or
>> shift right
<< shift left
~ not
>>>>>> 3 & 1>>> 3 & 1
1
>>>
>>> 3 & 1
1
>>> 1 << 10
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
>>>
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
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
>>>
Comparison Operators
> greater than
>= greater than or equal to
< less than
<= less than or equal to
== equal to
!= not equal to
List
Contents are
surrounded by
square brackets
and separate by
comma.
>>>
List
Contents are
surrounded by
square brackets
and separate by
comma.
>>>>>> [“aaa”, “bbb”, 1, 2]
List
Contents are
surrounded by
square brackets
and separate by
comma.
>>>>>> [“aaa”, “bbb”, 1, 2]>>> [“aaa”, “bbb”, 1, 2]
[‘aaa’, ‘bbb’, 1, 2]
>>>
Initialization / Conversion
>>>
Initialization / Conversion
>>>>>> list([1, 2, 3])
Initialization / Conversion
>>>>>> list([1, 2, 3])>>> list([1, 2, 3])
[1, 2, 3]
>>>
Initialization / Conversion
>>>>>> list([1, 2, 3])>>> list([1, 2, 3])
[1, 2, 3]
>>>
>>> list([1, 2, 3])
[1, 2, 3]
>>> list(“abc”)
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’]
>>>
Operators
+ append
* repeat
>>>
Operators
+ append
* repeat
>>>>>> x = [1, 2, 3]
Operators
+ append
* repeat
>>>>>> x = [1, 2, 3]>>> x = [1, 2, 3]
>>>
Operators
+ append
* repeat
>>>>>> x = [1, 2, 3]>>> x = [1, 2, 3]
>>>
>>> x = [1, 2, 3]
>>> y = [‘a’, ‘b’]
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’]
>>>
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
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]
>>>
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
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’]
>>>
>>>
Access Element
>>>>>> x = [1, 2, 3, 4, 5]
Access Element
>>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5]
>>>
Access Element
>>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5]
>>>
>>> x = [1, 2, 3, 4, 5]
>>> x[1]
Access Element
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>
Slice
[start:end(:step)]
>>>
Slice
[start:end(:step)]
[0:length(:1)]
default value
>>>>>> x = [1, 2, 3, 4, 5]
Slice
[start:end(:step)]
[0:length(:1)]
default value
>>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5]
>>>
Slice
[start:end(:step)]
[0:length(:1)]
default value
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
>>>>>> 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
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab
Python @Wheel Lab

More Related Content

Similar to Python @Wheel Lab

3000 vocab by elang yudantoro
3000 vocab by elang yudantoro3000 vocab by elang yudantoro
3000 vocab by elang yudantoro
Elang Yudantoro
 
3.1 adma advanced copy the process
3.1 adma advanced copy the process3.1 adma advanced copy the process
3.1 adma advanced copy the process
Jon Maxim
 
EIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My Vibe
EIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My VibeEIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My Vibe
EIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My Vibe
European Innovation Academy
 
Critical ThinkingThe Art of ArgumentPower Point Presentat.docx
Critical ThinkingThe Art of ArgumentPower Point Presentat.docxCritical ThinkingThe Art of ArgumentPower Point Presentat.docx
Critical ThinkingThe Art of ArgumentPower Point Presentat.docx
mydrynan
 
Sentences clauses and colons
Sentences clauses and colonsSentences clauses and colons
Sentences clauses and colons
MsCaldwell
 
Les articles en français
Les articles en françaisLes articles en français
Les articles en français
kvarela
 

Similar to Python @Wheel Lab (20)

Simple is better than complex. ~私がPythonを愛する理由~
Simple is better than complex. ~私がPythonを愛する理由~Simple is better than complex. ~私がPythonを愛する理由~
Simple is better than complex. ~私がPythonを愛する理由~
 
What We Talk About When We Talk About Coding (Open Source Bridge 6/21)
What We Talk About When We Talk About Coding (Open Source Bridge 6/21)What We Talk About When We Talk About Coding (Open Source Bridge 6/21)
What We Talk About When We Talk About Coding (Open Source Bridge 6/21)
 
English Idioms
English IdiomsEnglish Idioms
English Idioms
 
3000 vocab by elang yudantoro
3000 vocab by elang yudantoro3000 vocab by elang yudantoro
3000 vocab by elang yudantoro
 
Remote Working at Spry Fox
Remote Working at Spry FoxRemote Working at Spry Fox
Remote Working at Spry Fox
 
English Improvement 7 Novemberi
English Improvement  7 NovemberiEnglish Improvement  7 Novemberi
English Improvement 7 Novemberi
 
Look beyond PHP
Look beyond PHPLook beyond PHP
Look beyond PHP
 
Pragmatics 1
Pragmatics 1Pragmatics 1
Pragmatics 1
 
3.1 adma advanced copy the process
3.1 adma advanced copy the process3.1 adma advanced copy the process
3.1 adma advanced copy the process
 
EIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My Vibe
EIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My VibeEIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My Vibe
EIA2018ITALY - Bianca Praetorius - Pitch Don’t Kill My Vibe
 
Buenas Prácticas de Python
Buenas Prácticas de PythonBuenas Prácticas de Python
Buenas Prácticas de Python
 
Technology So Easy Your Lawyer Could Do It (OSCON 5/18)
Technology So Easy Your Lawyer Could Do It (OSCON 5/18)Technology So Easy Your Lawyer Could Do It (OSCON 5/18)
Technology So Easy Your Lawyer Could Do It (OSCON 5/18)
 
Critical ThinkingThe Art of ArgumentPower Point Presentat.docx
Critical ThinkingThe Art of ArgumentPower Point Presentat.docxCritical ThinkingThe Art of ArgumentPower Point Presentat.docx
Critical ThinkingThe Art of ArgumentPower Point Presentat.docx
 
Beyond your studies
Beyond your studiesBeyond your studies
Beyond your studies
 
Distancing
DistancingDistancing
Distancing
 
Sentences clauses and colons
Sentences clauses and colonsSentences clauses and colons
Sentences clauses and colons
 
Les articles en français
Les articles en françaisLes articles en français
Les articles en français
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation Skills
 
Spoken english
Spoken englishSpoken english
Spoken english
 
Spokenenglishflourishyourlanguage 120621110631-phpapp01
Spokenenglishflourishyourlanguage 120621110631-phpapp01Spokenenglishflourishyourlanguage 120621110631-phpapp01
Spokenenglishflourishyourlanguage 120621110631-phpapp01
 

More from Chih-Hsuan Kuo

[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism
Chih-Hsuan Kuo
 
[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm
Chih-Hsuan Kuo
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set
Chih-Hsuan Kuo
 
[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm
Chih-Hsuan Kuo
 
[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up
Chih-Hsuan Kuo
 

More from Chih-Hsuan Kuo (20)

Rust
RustRust
Rust
 
[Mozilla] content-select
[Mozilla] content-select[Mozilla] content-select
[Mozilla] content-select
 
在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。
 
Use C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in GeckoUse C++ to Manipulate mozSettings in Gecko
Use C++ to Manipulate mozSettings in Gecko
 
Pocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OSPocket Authentication with OAuth on Firefox OS
Pocket Authentication with OAuth on Firefox OS
 
Necko walkthrough
Necko walkthroughNecko walkthrough
Necko walkthrough
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
 
面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!
 
應徵軟體工程師
應徵軟體工程師應徵軟體工程師
應徵軟體工程師
 
面試心得分享
面試心得分享面試心得分享
面試心得分享
 
Windows 真的不好用...
Windows 真的不好用...Windows 真的不好用...
Windows 真的不好用...
 
Introduction to VP8
Introduction to VP8Introduction to VP8
Introduction to VP8
 
[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism
 
[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set
 
[ACM-ICPC] Traversal
[ACM-ICPC] Traversal[ACM-ICPC] Traversal
[ACM-ICPC] Traversal
 
[ACM-ICPC] UVa-10245
[ACM-ICPC] UVa-10245[ACM-ICPC] UVa-10245
[ACM-ICPC] UVa-10245
 
[ACM-ICPC] Sort
[ACM-ICPC] Sort[ACM-ICPC] Sort
[ACM-ICPC] Sort
 
[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm[ACM-ICPC] Efficient Algorithm
[ACM-ICPC] Efficient Algorithm
 
[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up[ACM-ICPC] Top-down & Bottom-up
[ACM-ICPC] Top-down & Bottom-up
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

Python @Wheel Lab

  • 2. Latest update: Jun 30, 2013 Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/
  • 4. What is Python? a programming language
  • 5. What is Python? easy to Read easy to Learn easy to Write a programming language
  • 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. 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. 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. What does the logo mean?
  • 10. 界 Kingdom 動物界 Animalia 門 Phylum 脊索動物門 Chordata 綱 Class 爬蟲科 Reptilia 目 Order 有鱗目 Squamata 科 Family 蟒科 Pythonidae 屬 Genus 蟒屬 Python
  • 14. More About Python... Interpreted Language Do not need to compile!
  • 16. Interpreted Language execute But, interpret in execution time. And, it would be slow...
  • 17. More About Python... Object-Oriented Language Everything in Python is object!
  • 21. More About Python... Imperative Programming Generic Programming Functional Programming
  • 23. There should be one— and preferably only one —obvious way to do it. Philosophy
  • 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.
  • 26. $$ python -ic “” Zen of Python
  • 27. $$ python -ic “”$ python -ic “” >>> Zen of Python
  • 28. $$ python -ic “”$ python -ic “” >>> $ python -ic “” >>> import this Zen of Python
  • 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
  • 32. Current Situation Python 2.x Python 3.x Coexist!
  • 33. Current Situation Python 2.x Python 3.x Coexist!
  • 34. Current Situation Python 2.x Python 3.x Coexist! backwards-incompatible
  • 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
  • 40. Environment For Unix-like OS User, Python 2.x is Built-in!
  • 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.
  • 43. $ Check Version of Python $ python --version
  • 44. $ Check Version of Python $ python --version$ python --version Python 2.7.5
  • 45. $ Check Version of Python $ python --version$ python --version Python 2.7.5 2.7.5 is released on May 15, 2013
  • 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. $$ 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
  • 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. $$ 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. $$ 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!
  • 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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. $$ 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
  • 76. Hello World! if __name__ == “__main__”: print “Hello World!” helloworld.py
  • 78. $ Hello World! $ python helloworld.py
  • 79. $ Hello World! $ python helloworld.py$ python helloworld.py Hello World! $
  • 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. 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
  • 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 4 = 12 3 x 5 = 15 2 x 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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. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!”
  • 87. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!”
  • 88. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!” and write all statements after it.
  • 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. 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. 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. 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. You can use to identify scopes.
  • 94. You can use one space two spaces three spaces four spaces lots of spaces to identify scopes.
  • 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. But, you should unify the style!
  • 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. Initialization / Conversion data type initial int int(x) long long(x) float float(x) complex complex(x) complex(x, y) >>>
  • 100. Initialization / Conversion data type initial int int(x) long long(x) float float(x) complex complex(x) complex(x, y) >>>>>> int(10)
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>
  • 111. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>>>> 2**10
  • 112. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>>>> 2**10>>> 2**10 1024 >>>
  • 113. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>>>> 2**10>>> 2**10 1024 >>> >>> 2**10 1024 >>> 5.8 // 2
  • 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. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>
  • 116. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>>>> 3 & 1
  • 117. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>>>> 3 & 1>>> 3 & 1 1 >>>
  • 118. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>>>> 3 & 1>>> 3 & 1 1 >>> >>> 3 & 1 1 >>> 1 << 10
  • 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. 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. 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. Comparison Operators > greater than >= greater than or equal to < less than <= less than or equal to == equal to != not equal to
  • 123. List Contents are surrounded by square brackets and separate by comma. >>>
  • 124. List Contents are surrounded by square brackets and separate by comma. >>>>>> [“aaa”, “bbb”, 1, 2]
  • 125. List Contents are surrounded by square brackets and separate by comma. >>>>>> [“aaa”, “bbb”, 1, 2]>>> [“aaa”, “bbb”, 1, 2] [‘aaa’, ‘bbb’, 1, 2] >>>
  • 128. Initialization / Conversion >>>>>> list([1, 2, 3])>>> list([1, 2, 3]) [1, 2, 3] >>>
  • 129. Initialization / Conversion >>>>>> list([1, 2, 3])>>> list([1, 2, 3]) [1, 2, 3] >>> >>> list([1, 2, 3]) [1, 2, 3] >>> list(“abc”)
  • 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’] >>>
  • 133. Operators + append * repeat >>>>>> x = [1, 2, 3]>>> x = [1, 2, 3] >>>
  • 134. Operators + append * repeat >>>>>> x = [1, 2, 3]>>> x = [1, 2, 3] >>> >>> x = [1, 2, 3] >>> y = [‘a’, ‘b’]
  • 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. 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. 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. 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. 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’] >>>
  • 141. >>>>>> x = [1, 2, 3, 4, 5] Access Element
  • 142. >>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5] >>> Access Element
  • 143. >>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5] >>> >>> x = [1, 2, 3, 4, 5] >>> x[1] Access Element
  • 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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
  • 151. >>>>>> x = [1, 2, 3, 4, 5] Slice [start:end(:step)] [0:length(:1)] default value
  • 152. >>>>>> x = [1, 2, 3, 4, 5]>>> x = [1, 2, 3, 4, 5] >>> Slice [start:end(:step)] [0:length(:1)] default value
  • 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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. >>>>>> 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