SlideShare a Scribd company logo
Python
郭⾄至軒(KuoE0)
KuoE0.tw@gmail.com
KuoE0.ch

@ Programming Language 2013
Attribution-ShareAlike 3.0 Unported
(CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Latest update: Jan 10, 2014,
What is Python?
What is Python?

a programming language
What is Python?
easy to Read
easy to Write
easy to Learn
a programming language
Top Language in TIOBE
Position
May 2013

Position
May 2012

Delta in
Position

Programming Language

1
2
3
4
5
6
7
8
9
10

1
2
4
3
5
6
7
8
9
11

=
=
↑
↓
=
=
=
=
=
↑

C
Java
Objective-C
C++
C#
PHP
Visual Basic
Python
Perl
Ruby
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Top Languages in Github
Javascript

21%

Ruby

12%

Java

8%

Python

8%

Shell

8%

PHP

7%

C

6%

C++

5%

Perl

4%

Objective-C

3%
0%

5%

10%

15%

20%

25%
https://github.com/languages
Top Languages in Github
Javascript

21%

Ruby

12%

Java

8%

Python

8%

Shell

8%

PHP

7%

C

6%

C++

5%

Perl

4%

Objective-C

3%
0%

5%

10%

15%

20%

25%
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
But, interpret in execution time.
execute

And, it would be slow...
More About Python...
Object-Oriented Language

Everything in Python is object!
number
string
list
function

Object
number
string
list
function

Object
overloading
inheritance
multiple inheritance
polymorphism
More About Python...
Imperative Programming
Generic Programming
Functional Programming
Philosophy
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
$
Zen of Python
$ python -ic “”
Zen of Python
$ python -ic “”
>>>
Zen of Python
$ python -ic “”
>>> import this
Zen of Python
one
There
temptation to guess. and refuse
In --obviousbe
Unless
Errors
Althoughcasesbetter
breakis betternever pass Peters
Specialfacebetter may beats
ReadabilityPython,tonested.
Sparse explicitly silenced.
FlatZenshould“”ambiguity,silently.
Complexispracticality dense. obvious
Simpleshouldofaren'tthanit. enough
Explicitisrules. than complex.
Beautifulisthisthanthan implicit.the at
The importbetterone--docomplicated. only
>>>thethe-iccounts.byspecialpurity. to
$ pythonofisbetterthanTimugly.
that way
not preferably
be
first
one
There
temptation to way
In --obvious guess. and preferably
Unless casesyou're
Errors betternever Dutch.refuse
Althoughisrules. may beats
breakisfacebetter topass Peters
Specialexplicitlythan dense.
ReadabilityPython,silenced.
Sparseunlessofaren'tnested. obvious
FlatZenshouldbeambiguity,silently.
Complexisthatbetter thanit. enough
Simpleshouldcounts.than implicit.the at
Explicitofbetterone-- complex.
Beautifulpracticalitydocomplicated. only
The importisbetterthanTimugly.
>>>thetheisthisthanbyspecialpurity. to
not be
Now
first
one is cases than
There
temptationrules.
In --obvious way may and preferably
Unless betterguess. beats
Errors better never Dutch.refuse
Althoughisbetterone-- dense.
breakisfacetoyou're pass Peters
Specialexplicitly tonested.
Readabilitybetterthan complex.
Sparseunlessofaren'tthanit. obvious
FlatZenshouldbethannever.silently.
Complexisthatbetterthan implicit.the
Simpleshouldcounts.bydocomplicated. at
Explicitofisbettersilenced. enough only
Beautifulpracticalityspecialpurity. to
ThethetheisPython,thanTimugly.
ambiguity, be
not
Now
first
one is cases thanmay not preferably
There
temptationbetterone-- andsilently.
In the better way to beats
Unless face
Errorsunlessofguess. dense.
Althoughbetternever Dutch.refuse
breakisexplicitly silenced.
Specialshould aren'tpassbetter
Readabilitytoyou're nested. obvious
Sparseshouldcounts. thanit. enough
Flat--obviousbethannever.ugly.
Complexisthatbetterthan implicit.the at
Simplethepracticalitydocomplicated. only
Explicitisisbetterthancomplex. than *right*
Beautifulisbetterthanspecialpurity. to
never ambiguity, be
rules. often
is
now.
Now
first
one is cases thanmay not preferably
There
temptationbetterone-- andsilently.
In the better way to beats
Unless face
Errorsunlessofguess. dense.
Althoughbetternever Dutch.refuse
breakisexplicitly silenced.
Specialshould aren'tpassbetter
Readabilitytoyou're nested. obvious
Sparseshouldcounts. thanit. enough
Flat--obviousbethannever.ugly.
Complexisthatbetterthan implicit.the at
Simplethepracticalitydocomplicated. only
Explicitisisbetterthancomplex. than *right*
Beautifulisbetterthanspecialpurity. to
never ambiguity, be
rules. often
is
If
now.
Now
first
one is cases thanoften
There implementation isbetter
temptationrules. may not preferably
In the better way to andhard than
Unless face ofguess. beats
Errorsunlesscounts. Dutch.refuse
Althoughbetternever passit.
breakisexplicitly silenced.
Specialshould aren'tnested. obvious
Readabilitytoyou'renever.silently.
Sparseshouldbetterthandense. enough at
Flat--obviousbethanthan implicit.explain,
Complexispracticality complex.to the only
Simpletheisbetterthandocomplicated. *right*
Explicitisbetterone--specialpurity. to
never is
that ambiguity, be
it's
If
now.
Now
first
one is bad idea. may isbetter
Therea implementation not preferably
temptationrules. to andhard than
In the better way silenced.
Unless faceto guess. beats
Errorsunlessofnever
Althoughisbetterone-- dense.
breakisexplicitly thancomplex.to explain,
Specialshould aren'tDutch.refuse the
Readabilitybetterthandocomplicated.
Sparseshouldcounts. passit. obvious at
Flat--obviousyou're nested. enough only
Complexisthatbethannever.silently. *right*
Simplethepracticalityspecialpurity. to
cases ambiguity, be
betterthanoften
never is
it's
If
now.
Now
first bad idea. may
one is implementation isbetter
Therea better way to noteasy
temptationrules. silenced.
In the faceto guess. andhard than
Unlessunlessofnever
Errorsshouldcounts. Dutch.refuse explain,
Althoughisbetterone-- beats
breakisexplicitly thandense. to the
Specialshould aren'tpassit. obvious
Readabilitybetterthandocomplicated. at
Sparsethethatyou're nested. enough only
Flat--obviousbethannever.silently. *right*
Complexispracticalityspecialpurity. to
cases ambiguity, preferably
betterthanoften
never is
be
it
it's
If
now.
Now is badrules. may
first implementation is preferably
onemay better thanto noteasy
Therea faceidea. silenced.
temptationbetterone-- andhard than
In the explicitlyidea.beats
Unlessunlessofwaythan dense.
Errorsshouldcounts.
Althoughbetterguess. do betterto explain,
breakisshould never Dutch.refuse the
Specialisthat aren'tpassit. obvious at
Readabilitytoyou're nested. enough only
Sparsethepracticalityspecialpurity. *right*
Flat--obviousbethannever.silently. to
benever ambiguity, be
cases is often
a good
Namespacesaare is often
it
it's
If
now.is badrules. may
Now --obvious thanto is
first implementation not be
onemay better way silenced.
There faceidea. idea.andeasy than
temptationbetterone-- beats
In the explicitlythan dense. obvious
Unless should guess. do betterto idea
Errorsunlessofnever Dutch.preferably
Althoughcases aren'tpassit.great explain,
breakashouldcounts.honkingrefuse the at
Specialisthatyou'renever.hardenough only
Readabilitytobeambiguity,silently. *right*
Sparsethepracticalityspecialpurity. to-benever one
good
let's bad good often
Namespacesaareof may
it
it's
If
now.is implementation is
Now --obvious thanto not be
first better way silenced.
onemay faceidea. those!
There explicitlyidea.andeasy than
temptationrules.one-- beats obvious
In thedo that guess. do betterto idea
Unlessunlessofnever Dutch.preferably
Errorsshouldcounts.honkingrefuse explain,
Althoughcases aren'tpassit.great the at
breakathepracticalityspecialpurity. only
Specialshouldyou'renever.hardenough *right*
Readabilitytobeambiguity,silently. to-benever is
more one
>>>
let's bad areof often
Namespacesaidea. may is
it
it's
If
now.is implementation not
Now --obvious thanto and be
first better way silenced.
onemay faceto guess.Dutch.preferably
There explicitlythose! easy than
temptationrules. idea.beats obvious
In thedo that neverhonkingrefuse idea
Unlessunlessgoodone--do betterto explain,
Errorsshouldofaren'tpassit.great the at
Althoughcasesyou'renever.hardenough only
breakathepracticalityspecialpurity. *right*
Specialshouldbeambiguity,silently. to-benever is
more one
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
backwards-incompatible

Python 2.x

Python 3.x

Coexist!
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
Python 3 的新特性
http://www.ibm.com/developerworks/cn/linux/l-python3-1/
Python 2.x
Today, Let’s Talk About

Python 2.x
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 2.7.5
Check Version of Python
$ python --version
Python 2.7.5

2.7.5 is released on May 15, 2013
Check Version of Python
$
Check Version of Python
$ python
Check Version of 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 2.7.5 (default, May 20 2013,
23:41:46)
[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
$
Interactive Shell
$ python
Interactive Shell
$ python
Python 2.7.5 (default, May 20 2013,
23:41:46)
[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 2.7.5 (default, May 20 2013,
23:41:46)
[GCC 4.2.1 Compatible Apple LLVM 4.2
(clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or
"license" for more information.
>>>

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

prompt

means that your turn!
Interactive Shell
$
Interactive Shell
$ python
Interactive Shell
$ python
Python 2.7.5 (default, May 20 2013,
23:41:46)
[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 2.7.5 (default, May 20 2013,
23:41:46)
[GCC 4.2.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 2.7.5 (default, May 20 2013,
23:41:46)
[GCC 4.2.1 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 2.7.5 (default, May 20 2013,
23:41:46)
[GCC 4.2.1 Compatible Apple 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 2.7.5 (default, May 20 2013,
23:41:46)
[GCC 4.2.1 Compatible Apple LLVM 4.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 2.7.5 (default, May 20 2013,
23:41:46)
[GCC 4.2.1 Compatible Apple LLVM 4.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 2.7.5 (default, May 20 2013,
$ python
23:41:46)
Python 2.7.5 (default, May 20 2013,
[GCC 4.2.1
23:41:46) Compatible Apple LLVM 4.2
(clang-425.0.28)] on Apple
[GCC 4.2.1 Compatibledarwin LLVM 4.2
Type "help", "copyright", "credits" or
(clang-425.0.28)] on darwin
"license" for more information.
Type "help", "copyright", "credits" or
>>> 1 + 2 + 3
"license" for more information.
6
>>> 1 + 2 + 3
>>> “Hello World”
6
‘Hello World’
>>> “Hello World”
>>> x
‘Hello=World’
100
>>> x = 100
Interactive Shell
Python 2.7.5 (default, May 20 2013,
$ python
23:41:46)
Python 2.7.5 (default, May 20 2013,
[GCC 4.2.1
23:41:46) Compatible Apple LLVM 4.2
(clang-425.0.28)] on Apple
[GCC 4.2.1 Compatibledarwin LLVM 4.2
Type "help", "copyright", "credits" or
(clang-425.0.28)] on darwin
"license" for more information.
Type "help", "copyright", "credits" or
>>> 1 + 2 + 3
"license" for more information.
6
>>> 1 + 2 + 3
>>> “Hello World”
6
‘Hello World’
>>> “Hello World”
>>> x
‘Hello=World’
100
>>> x = 100
y
200
Interactive Shell
23:41:46)
Python 2.7.5 (default, May 20 2013,
$ python
[GCC 4.2.1
23:41:46) Compatible May LLVM 4.2
Python 2.7.5 (default,Apple20 2013,
(clang-425.0.28)] on Apple
[GCC 4.2.1
23:41:46) Compatibledarwin LLVM 4.2
Type "help", "copyright", "credits"
(clang-425.0.28)] on Apple
[GCC 4.2.1 Compatibledarwin LLVM 4.2or
"license" for more information.
Type "help", "copyright", "credits" or
(clang-425.0.28)] on darwin
>>>
"license" for more information.
Type1"help",3"copyright", "credits" or
+ 2 +
6
>>> 1 + 2 + 3
"license" for more information.
6
>>> “Hello+World”
1 + 2
3
‘Hello World’
>>> “Hello World”
6
‘Hello=World’
>>> “Hello World”
x
100
>>> x
‘Hello=World’
y
200
100
>>> x = 100
y
200
Interactive Shell
23:41:46)
Python 2.7.5 (default, May 20 2013,
$ python
[GCC 4.2.1
23:41:46) Compatible May LLVM 4.2
Python 2.7.5 (default,Apple20 2013,
(clang-425.0.28)] on Apple
[GCC 4.2.1
23:41:46) Compatibledarwin LLVM 4.2
Type "help", "copyright", "credits"
(clang-425.0.28)] on Apple
[GCC 4.2.1 Compatibledarwin LLVM 4.2or
"license" for more information.
Type "help", "copyright", "credits" or
(clang-425.0.28)] on darwin
>>>
"license" for more information.
Type1"help",3"copyright", "credits" or
+ 2 +
6
>>> 1 + 2 + 3
"license" for more information.
6
>>> “Hello+World”
1 + 2
3
‘Hello World’
>>> “Hello World”
6
‘Hello=World’
>>> “Hello World”
x
100
>>> x
‘Hello=World’
y
200
100
>>> x = y
y + 100
200
Interactive Shell
(clang-425.0.28)] on darwin
23:41:46)
Python 2.7.5 (default, May 20 2013,
$ python
Type "help", "copyright",
[GCC 4.2.1
23:41:46) Compatible May"credits"
Python 2.7.5 (default,Apple20 2013, or
LLVM 4.2
"license"
(clang-425.0.28)] information.
[GCC 4.2.1 Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
>>>
Type "help",3"copyright", "credits"
(clang-425.0.28)] on Apple
[GCC14.2.1+Compatibledarwin LLVM 4.2or
+ 2
6
"license" for more information.
Type "help", "copyright", "credits" or
(clang-425.0.28)] on darwin
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
+ 2
‘Hello 2 + 3
6
>>> 1 +World’
"license" for more information.
6
>>> “Hello+World”
x + 2
1 = 100 3
‘Hello=World’
>>> “Hello World”
6
y
200
‘Hello=World’
>>> “Hello World”
x + y
100
300 y
>>> x
‘Hello=World’
200
100
>>> x = y
y + 100
200
Interactive Shell
(clang-425.0.28)] on darwin
23:41:46)
Python 2.7.5 (default, May 20 2013,
$ python
Type "help", "copyright",
[GCC 4.2.1
23:41:46) Compatible May"credits"
Python 2.7.5 (default,Apple20 2013, or
LLVM 4.2
"license"
(clang-425.0.28)] information.
[GCC 4.2.1 Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
>>>
Type "help",3"copyright", "credits"
(clang-425.0.28)] on Apple
[GCC14.2.1+Compatibledarwin LLVM 4.2or
+ 2
6
"license" for more information.
Type "help", "copyright", "credits" or
(clang-425.0.28)] on darwin
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
+ 2
‘Hello 2 + 3
6
>>> 1 +World’
"license" for more information.
6
>>> “Hello+World”
x + 2
1 = 100 3
‘Hello=World’
>>> “Hello World”
6
y
200
‘Hello=World’
>>> “Hello World”
x + y
100
300 y
>>> x
‘Hello=World’
200
100
>>> for y in range(5):
y + 100
x = i
200
Interactive Shell
Type "help", "copyright",
(clang-425.0.28)] on darwin20 2013,
23:41:46)
Python 2.7.5 (default, May"credits" or
$ python
"license"
Type "help", more information.
[GCC 4.2.1 Compatible May LLVM 4.2
23:41:46) for"copyright", "credits"
Python 2.7.5 (default,Apple20 2013, or
>>>
"license"
(clang-425.0.28)] information.
[GCC14.2.1+Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
+ 2
3
6
>>>
Type "help",3"copyright", "credits"
(clang-425.0.28)] on Apple
[GCC14.2.1+Compatibledarwin LLVM 4.2or
+ 2
>>> "help", more
6
"license" World” information.
Type“Hellofor"copyright", "credits" or
(clang-425.0.28)] on darwin
‘Hello+World’
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
2
‘Hello+ 100 3
6
>>> 1 =World’
"license" for more information.
x
2 +
6
>>> “Hello+World”
y
x + 200
1 = 100 3
2
‘Hello=World’
>>> “Hello World”
6
x
y + y
200
300 x + y
‘Hello=World’
>>> “Hello World”
100
300 x
>>> for i in
‘Hello=World’range(5):
y
200
100
... x = i
>>> for y in range(5):
y + 100
200
Interactive Shell
Type "help", "copyright",
(clang-425.0.28)] on darwin20 2013,
23:41:46)
Python 2.7.5 (default, May"credits" or
$ python
"license"
Type "help", more information.
[GCC 4.2.1 Compatible May LLVM 4.2
23:41:46) for"copyright", "credits"
Python 2.7.5 (default,Apple20 2013, or
>>>
"license"
(clang-425.0.28)] information.
[GCC14.2.1+Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
+ 2
3
6
>>>
Type "help",3"copyright", "credits"
(clang-425.0.28)] on Apple
[GCC14.2.1+Compatibledarwin LLVM 4.2or
+ 2
>>> "help", more
6
"license" World” information.
Type“Hellofor"copyright", "credits" or
(clang-425.0.28)] on darwin
‘Hello+World’
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
2
‘Hello+ 100 3
6
>>> 1 =World’
"license" for more information.
x
2 +
6
>>> “Hello+World”
y
x + 200
1 = 100 3
2
‘Hello=World’
>>> “Hello World”
6
x
y + y
200
300 x + y
‘Hello=World’
>>> “Hello World”
100
300 x
>>> for i in
‘Hello=World’range(5):
y
200
100
... x = y in i
>>> for printrange(5):
y + i
200
100
Interactive Shell
"license"
Type "help", more information.
(clang-425.0.28)] on darwin
23:41:46)
Python 2.7.5 "copyright", 20 2013,
$ python for(default, May"credits" or
>>>
"license"
Type "help", more information.
[GCC14.2.1+Compatible May LLVM 4.2
23:41:46) for"copyright", "credits"
Python+2.7.53(default,Apple20 2013, or
2
6
>>>
"license"
(clang-425.0.28)] information.
[GCC14.2.1+Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
+ 2
3
6
>>> "help",3"copyright", "credits"
Type14.2.1 Compatible Apple
(clang-425.0.28)]
[GCC“Hello+World” on darwin LLVM 4.2or
+ 2
‘Hello World’
>>> "help", more
6
"license" World” information.
Type“Hellofor"copyright", "credits" or
(clang-425.0.28)] on darwin
‘Hello=World’
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
x + 100
2
‘Hello+ 100 3
6
>>> 1 =World’
"license" for more information.
y
x
200
2 +
6
>>> “Hello+World”
y
x + 100 3
1 = y
200
2
300 y + y
‘Hello=World’
>>> “Hello World”
6
x
200
300 for y World”
‘Hello=World’
>>> “Helloin range(5):
x + i
100
... y
300 x
>>> for print i
‘Hello=World’range(5):
i in
200
100
... x = y in i
>>> for printrange(5):
y + i
200
100
Interactive Shell
>>>
"license"
Typey"help",
(clang-425.0.28)] information.
23:41:46) for moreon darwin
Python=2.7.5 "copyright", 20 2013,
$ python200 (default, May"credits" or
>>>
"license"
Typex"help", more information.
[GCC14.2.1+Compatible May LLVM 4.2
23:41:46) for"copyright", "credits"
Python+2.7.53(default,Apple20 2013, or
y
2
300
6
>>>
"license"
(clang-425.0.28)] information.
[GCC14.2.1+Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
+ 2
3
6
>>> 14.2.1 Compatible
Typefor i +World”
(clang-425.0.28)] on darwin
[GCC“Helloin3range(5):Apple LLVM 4.2or
"help", "copyright", "credits"
+ 2
...
‘Hello World’ more
>>> "help", i
6
"license" World” information.
Type“Hellofor"copyright", "credits" or
(clang-425.0.28)] on darwin
print
... x + 100
‘Hello=World’
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
2
0
‘Hello+ 100 3
6
>>> 1 =World’
"license" for more information.
y
x
200
2 +
1
6
>>> “Hello+World”
y
x + 100 3
1 = y
200
2
2
300 y + y
‘Hello=World’
>>> “Hello World”
6
x
200
3
300 for y World”
‘Hello=World’
>>> “Helloin range(5):
x + i
100
4
... y
300 x
>>> for print i
‘Hello=World’range(5):
i in
200
100
... x = y in i
>>> for printrange(5):
y + i
200
100
Interactive Shell
>>>
"license"
Typey"help",
(clang-425.0.28)] information.
23:41:46) for moreon darwin
Python=2.7.5 "copyright", 20 2013,
$ python200 (default, May"credits" or
>>>
"license"
Typex"help", more information.
[GCC14.2.1+Compatible May LLVM 4.2
23:41:46) for"copyright", "credits"
Python+2.7.53(default,Apple20 2013, or
y
2
300
6
>>>
"license"
(clang-425.0.28)] information.
[GCC14.2.1+Compatible Apple
23:41:46) for moreon darwin LLVM 4.2
+ 2
3
6
>>> 14.2.1 Compatible
Typefor i +World”
(clang-425.0.28)] on darwin
[GCC“Helloin3range(5):Apple LLVM 4.2or
"help", "copyright", "credits"
+ 2
...
‘Hello World’ more
>>> "help", i
6
"license" World” information.
Type“Hellofor"copyright", "credits" or
(clang-425.0.28)] on darwin
print
... x + 100
‘Hello=World’
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
2
0
‘Hello+ 100 3
6
>>> 1 =World’
"license" for more information.
y
x
200
2 +
1
6
>>> “Hello+World”
y
x + 100 3
1 = y
200
2
2
300 y + y
‘Hello=World’
>>> “Hello World”
6
x
200
3
300 for y World”
‘Hello=World’
>>> “Helloin range(5):
x + i
100
4
... y
300 x
>>> for print i
‘Hello=World’range(5):
i in
200
100
... x = y in i
>>> for printrange(5):
exit()
y + i
200
100
Interactive Shell
>>> x + 200
"license"
Typey"help", more information.
(clang-425.0.28)] on darwin
23:41:46)
Python=2.7.5 "copyright", 20 2013,
$ pythony for(default, May"credits" or
300
>>>
"license"
Typex"help", more information.
[GCC14.2.1+Compatible May LLVM 4.2
23:41:46) for"copyright", "credits"
Python+2.7.53(default,Apple20 2013, or
y
2
300
6
>>> 14.2.1
"license" +Compatible
(clang-425.0.28)] information.
[GCCfor i for moreon darwin
23:41:46) in3range(5):Apple LLVM 4.2
+ 2
... "help", i
6
>>> 14.2.1+World”
Typefor print"copyright", "credits"
(clang-425.0.28)] on darwin
[GCC“Helloin3range(5):Apple LLVM 4.2or
+ i Compatible
2
...
‘Hello World’ more
>>> "help", i
6
"license" World” information.
Type“Hellofor"copyright", "credits" or
(clang-425.0.28)] on darwin
print
0
... x + 100
‘Hello=World’
>>> 1"help",3 more
"license" +World” information.
Type“Hellofor"copyright", "credits" or
2
1
0
‘Hello+ 100 3
6
>>> 1 =World’
"license" for more information.
y
x
200
2 +
2
1
6
>>> “Hello+World”
y
x + 100 3
1 = y
200
2
3
2
300 y + y
‘Hello=World’
>>> “Hello World”
6
x
200
4
3
300 for y World”
‘Hello=World’
>>> “Helloin range(5):
x + i
100
4
... y
300 x
>>> for print i
‘Hello=World’range(5):
exit()in
i
200
100
$
... x = y in i
>>> for printrange(5):
exit()
y + i
200
100
Hello World!
Hello World!
if __name__ == “__main__”:
print “Hello World!”

helloworld.py
Hello World!
$
Hello World!
$ python helloworld.py
Hello World!
$ 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
8
7
6
5
4
3
2
$
8
7
6
5
4
3
2
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
2
9
8
7
6
5
4
3
9
8
7
6
5
4
3
$
9
8
7
6
5
4
3

x 1 = 4
python29x9table.py
9
8
7
6
5
4
3
2
63
56
49
7
54
48
42
45
40
35
30
25
5
36
32
28
20
27
24
21
15
9
3
18
16
14
12
10
8
6
x 1 = 2
9
8
7
6
5
4
3
2
64
63
56
49
7
54
48
42
45
40
35
30
25
5
36
32
28
20
27
24
21
15
9
3
18
16
14
12
10
8
6
4
x 2 = 4
1
9
8
7
6
5
4
3
72
64
63
56
49
7
54
48
42
45
40
35
30
25
5
36
32
28
20
27
24
21
15
9
3
18
16
14
12
10
8
6
x 3 = 6
2
1
9
8
7
6
5
4
72
64
63
56
49
7
54
48
42
45
40
35
30
25
5
36
32
28
20
4
27
24
21
15
9
3
18
16
14
12
10
8
x 4 = 8
3
2
1
9
8
7
6
5
72
64
63
56
49
7
54
48
42
45
40
35
30
25
5
36
32
28
20
4
27
24
21
15
9
6
3
18
16
14
12
10
x 5 = 10
4
3
2
1
9
8
7
6
72
64
63
56
49
7
54
48
42
45
40
35
30
25
5
36
32
28
20
8
4
27
24
21
15
9
6
3
18
16
14
12
x 6 = 12
5
4
3
2
1
9
8
7
72
64
63
56
49
7
54
48
42
45
40
35
30
25
10
5
36
32
28
20
8
4
27
24
21
15
9
6
3
18
16
14
x 7 = 14
6
5
4
3
2
1
9
8
72
64
63
56
49
7
54
48
42
45
40
35
30
25
10
5
36
32
28
20
8
4
27
24
21
15
12
9
6
3
18
16
x 8 = 16
7
6
5
4
3
2
1
9
72
64
63
56
49
14
7
54
48
42
45
40
35
30
25
10
5
36
32
28
20
8
4
27
24
21
15
12
9
6
3
18
x 9 = 18
8
7
6
5
4
3
2
1
72
64
63
56
49
14
7
54
48
42
45
40
35
30
25
10
5
36
32
28
20
16
8
4
27
24
21
15
12
9
6
3
x 1 = 3
9
8
7
6
5
4
3
2
72
64
63
56
49
14
7
54
48
42
45
40
35
30
25
10
5
36
32
28
20
16
8
4
27
24
21
18
15
12
9
6
x 2 = 6
1
9
8
7
6
5
4
3
81
72
64
63
56
49
14
7
54
48
42
45
40
35
30
25
10
5
36
32
28
20
16
8
4
27
24
21
18
15
12
9
x 3 = 9
2
1
9
8
7
6
5
4
81
72
64
63
56
49
14
7
54
48
42
6
45
40
35
30
25
10
5
36
32
28
20
16
8
4
27
24
21
18
15
12
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.
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
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
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
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

one tab

two spaces

two tabs

three spaces

three tabs

four spaces

four tabs

lots of spaces

lots of tabs

to identify scopes.
But, you should unify the style!
Built-in Data Type
Null
>>>

None
Null
>>> None

None
Null
None

>>> None
>>>
Boolean
>>>

True
False
Boolean
>>> 1 == 1

True
False
Boolean
True
False

>>> 1 == 1
True
>>>
Boolean
True
False

>>> 1 == 1
True
>>> 1 != 1
Boolean
True
False

>>> 1 == 1
True
>>> 1 != 1
False
>>>
Boolean
True
False

>>> 1 == 1
True
>>> 1 != 1
False
>>> True
Boolean
True
False

>>> 1 == 1
True
>>> 1 != 1
False
>>> True
True
>>>
Boolean
True
False

>>> 1 == 1
True
>>> 1 != 1
False
>>> True
True
>>> False
Boolean
True
False

True
>>> 1 == 1
>>>
True1 != 1
False
>>> 1 != 1
>>> True
False
True
>>> True
>>>
TrueFalse
False
>>> False
>>>
Boolean
>>>

True
False
Boolean
upper case
>>>

True
False
Boolean
upper case
>>> true

True
False
Boolean
upper case

True
False

>>> true
Traceback (most recent
call last):
File "<input>", line
1, in <module>
NameError: name 'true'
is not defined
>>>
Initialization / Conversion
>>>

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

True
False
Initialization / Conversion
True
False

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

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

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

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

>>> bool(1)
True
>>> bool(True)
True
>>> bool()
False
>>>
Logical Operators
>>>

and

and

or

or

not

not
Logical Operators
>>> (1 == 1) and True

and

and

or

or

not

not
Logical Operators
and

and

or

or

not

not

>>> (1 == 1) and True
True
>>>
Logical Operators
and

and

or

or

not

not

>>> (1 == 1) and True
True
>>> (1 == 1) or False
Logical Operators
and

and

or

or

not

not

>>> (1 == 1) and True
True
>>> (1 == 1) or False
True
>>>
Logical Operators
and

and

or

or

not

not

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

and

or

or

not

not

>>> (1 == 1) and True
True
>>> (1 == 1) or False
True
>>> not (1 == 1)
False
>>>
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(10)

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
>>> int(10)
10
>>>

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
>>> int(10)
10
>>> int(“100”)

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
>>> int(10)
10
>>> int(“100”)
100
>>>

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
>>> int(10)
10
>>> int(“100”)
100
>>> complex(10)

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
>>> int(10)
10
>>> int(“100”)
100
>>> complex(10)
(10+0j)
>>>

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
>>> int(10)
10
>>> int(“100”)
100
>>> complex(10)
(10+0j)
>>> complex(10, 3)

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
10
>>> int(10)
>>>
10 int(“100”)
100
>>> int(“100”)
>>>
100 complex(10)
(10+0j)
>>> complex(10)
>>> complex(10, 3)
(10+0j)
(10+3j)
>>> complex(10, 3)
>>>

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
10
>>> int(10)
>>>
10 int(“100”)
100
>>> int(“100”)
>>>
100 complex(10)
(10+0j)
>>> complex(10)
>>> complex(10, 3)
(10+0j)
(10+3j)
>>> complex(10, 3)
>>> complex(“20+5j”)

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
Initialization / Conversion
data type

initial
100
10
>>> int(10)
>>> complex(10)
10 int(“100”)
(10+0j)
100
>>> int(“100”)
>>> complex(10,
100 complex(10) 3)
(10+3j)
(10+0j)
>>> complex(10)
>>> complex(10, 3)
(10+0j)
complex(“20+5j”)
(20+5j)
(10+3j)
>>> complex(10, 3)
>>> complex(“20+5j”)

int

int(x)

long

long(x)

float

float(x)

complex

complex(x)
complex(x, y)
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
1024
>>>
Arithmetic Operators
+

addition

-

subtraction

*

multiplication

/

division

%

modular

**

exponential

//

floor division

>>> 2**10
1024
>>> 5.8 // 2
Arithmetic Operators
+

addition

-

subtraction

*

multiplication

/

division

%

modular

**

exponential

//

floor division

>>> 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
1
>>>
Bitwise Operators
&

and

|

or

^

exclusion or

>>

shift right

<<

shift left

~

not

>>> 3 & 1
1
>>> 1 << 10
Bitwise Operators
&

and

|

or

^

exclusion or

>>

shift right

<<

shift left

~

not

>>> 3 & 1
1
>>> 1 << 10
1024
>>>
Bitwise Operators
&

and

|

or

^

exclusion or

>>

shift right

<<

shift left

~

not

>>> 3 & 1
1
>>> 1 << 10
1024
>>> ~0
Bitwise Operators
&

and

|

or

^

exclusion or

>>

shift right

<<

shift left

~

not

>>> 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
String
Contents are
surrounded by
single quote or
double quote.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

... World!”””
>>> “““Hello
‘HellonWorld!’
... World!”””
>>> x = “““Hello
‘HellonWorld!’
... x = “““Hello
>>> World!”””
>>> print x
... World!”””
Hello
>>> print x
World!
>>>
Initialization / Conversion
>>>
Initialization / Conversion
>>> str(“I’m string”)
Initialization / Conversion
>>> str(“I’m string”)
“I’m string”
>>>
Initialization / Conversion
>>> str(“I’m string”)
“I’m string”
>>> str(100)
Initialization / Conversion
>>> str(“I’m string”)
“I’m string”
>>> str(100)
‘100’
>>>
Initialization / Conversion
>>> str(“I’m string”)
“I’m string”
>>> str(100)
‘100’
>>> str(complex(10, 3))
Initialization / Conversion
>>> str(“I’m string”)
“I’m string”
>>> str(100)
‘100’
>>> str(complex(10, 3))
‘(10+3j)’
>>>
Operators
>>>

+

concatenate

*

repeat
Operators
>>> x = “abc”

+

concatenate

*

repeat
Operators
>>> x = “abc”
>>>

+

concatenate

*

repeat
Operators
>>> x = “abc”
>>> ‘(’ + x + ‘)’

+

concatenate

*

repeat
Operators

+

concatenate

*

repeat

>>> x = “abc”
>>> ‘(’ + x + ‘)’
‘(abc)’
>>>
Operators

+

concatenate

*

repeat

>>> x = “abc”
>>> ‘(’ + x + ‘)’
‘(abc)’
>>> x * 3
Operators

+

concatenate

*

repeat

>>> x = “abc”
>>> ‘(’ + x + ‘)’
‘(abc)’
>>> x * 3
‘abcabcabc’
>>>
Operators

+

concatenate

*

repeat

>>> x = “abc”
>>> ‘(’ + x + ‘)’
‘(abc)’
>>> x * 3
‘abcabcabc’
>>> ‘(’ + x * 3 + ‘)’
Operators

+

concatenate

*

repeat

>>> x = “abc”
‘abc’
>>> ‘(’ + x + ‘)’
‘(abc)’
>>> x * 3
‘abcabcabc’
>>> ‘(’ + x * 3 + ‘)’
‘(abcabcabc)’
>>>
Operators

+

concatenate

*

repeat

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

+

concatenate

*

repeat

‘(abc)’ ‘abc’
>>> x = “abc”
>>> ‘(’ + x + ‘)’
x * 3
‘abcabcabc’
‘(abc)’
>>> ‘(’ + x * 3 + ‘)’
x * 3
‘(abcabcabc)’
‘abcabcabc’
>>> ‘(’++‘d’) * 3 ‘)’
(x
x * 3 +
‘abcdabcdabcd’
‘(abcabcabc)’
>>> (x + ‘d’) * 3
Access Character
>>>
Access Character
>>> x = ‘0123456789’
Access Character
>>> x = ‘0123456789’
>>>
Access Character
>>> x = ‘0123456789’
>>> x[1]
Access Character
>>> x = ‘0123456789’
>>> x[1]
‘1’
>>>
Access Character
>>> x = ‘0123456789’
>>> x[1]
‘1’
>>> x[1] = ‘0’
Access Character
>>> x = ‘0123456789’
>>> x[1]
‘1’
>>> x[1] = ‘0’
>>>
Access Character
>>>
>>>
‘1’
>>>
>>>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

‘123’
‘0123456789’
>>> x = “0123456789”
>>> x[::]
x[1:-1]
x[1:4]
x[:]
‘12345678’
‘123’
‘0123456789’
>>> x[:]
x[::2]
x[1:-1]
x[1:4]
‘02468’
‘12345678’
‘123’
‘0123456789’
>>> x[1:4]
x[::-1]
x[::2]
x[1:-1]
‘9876543210’
‘02468’
‘12345678’
‘123’
>>> x[1:-1]
x[::-1]
x[::2]
length of string
>>>

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

len(string)
length of string
len(string)

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

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

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

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

>>> x = ‘0123456789’
>>> len(x)
10
>>> len(x[::2])
5
>>>
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]
>>>
Initialization / Conversion
>>>
Initialization / Conversion
>>> list([1, 2, 3])
Initialization / Conversion
>>> list([1, 2, 3])
[1, 2, 3]
>>>
Initialization / Conversion
>>> list([1, 2, 3])
[1, 2, 3]
>>> list(“abc”)
Initialization / Conversion
>>> list([1, 2, 3])
[1, 2, 3]
>>> list(“abc”)
[‘a’, ‘b’, ‘c’]
>>>
Operators
>>>

+

append

*

repeat
Operators
>>> x = [1, 2, 3]

+

append

*

repeat
Operators
>>> x = [1, 2, 3]
>>>

+

append

*

repeat
Operators
>>> x = [1, 2, 3]
>>> y = [‘a’, ‘b’]

+

append

*

repeat
Operators

+

append

*

repeat

>>> x = [1, 2, 3]
>>> y = [‘a’, ‘b’]
>>>
Operators

+

append

*

repeat

>>> x = [1, 2, 3]
>>> y = [‘a’, ‘b’]
>>> x * 2
Operators

+

append

*

repeat

>>>
>>>
>>>
[1,
>>>

x = [1, 2, 3]
y = [‘a’, ‘b’]
x * 2
2, 3, 1, 2, 3]
Operators

+

append

*

repeat

>>>
>>>
>>>
[1,
>>>

x = [1, 2, 3]
y = [‘a’, ‘b’]
x * 2
2, 3, 1, 2, 3]
x + y
Operators

+

append

*

repeat

>>>
>>>
>>>
[1,
>>>
[1,
>>>

x = [1, 2, 3]
y = [‘a’, ‘b’]
x * 2
2, 3, 1, 2, 3]
x + y
2, 3, ‘a’, ‘b’]
Access Element
>>>
Access Element
>>> x = [1, 2, 3, 4, 5]
Access Element
>>> x = [1, 2, 3, 4, 5]
>>>
Access Element
>>> x = [1, 2, 3, 4, 5]
>>> x[1]
Access Element
>>> x = [1, 2, 3, 4, 5]
>>> x[1]
2
>>>
Access Element
>>> x = [1, 2, 3, 4, 5]
>>> x[1]
2
>>> x[1] = ‘0’
Access Element
>>> x = [1, 2, 3, 4, 5]
>>> x[1]
2
>>> x[1] = ‘0’
>>>
Access Element
>>>
>>>
2
>>>
>>>

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

x = [1, 2, 3, 4, 5]
x[1]
x[1] = ‘0’
x
‘0’, 3, 4, 5]
Slice
>>>

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

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

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

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

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

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

>>>
>>>
[1,
>>>

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

>>>
>>>
[1,
>>>
[1,
>>>

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

>>>
>>>
[1,
>>>
[1,
>>>

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

>>>
>>>
[1,
>>>
[1,
>>>
[2,
>>>

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

>>>
>>>
[1,
>>>
[1,
>>>
[2,
>>>

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

[1,
>>>
>>>
[1,
>>>
[2,
[1,
>>>
[2,
>>>

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

[1,
>>>
>>>
[1,
>>>
[2,
[1,
>>>
[2,
>>>

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

[1,
>>>
>>>
[2,
[1,
>>>
[2,
[1,
>>>
[1,
[2,
>>>

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

[1,
>>>
>>>
[2,
[1,
>>>
[2,
[1,
>>>
[1,
[2,
>>>

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

[2,
[1,
>>>
>>>
[2,
[1,
>>>
[2,
[1,
>>>
[5,
[1,
[2,
>>>

3]
2, [1, 5]
x =3, 4,2, 3, 4, 5]
x[1:-1]
x[1:3]
x[:]
x[::]
3,
3] 4]
2, 3, 4, 5]
x[::2]
x[1:-1]
x[1:3]
x[:]
3, 5]
3] 4]
2, 3, 4, 5]
x[::-1]
x[::2]
x[1:-1]
x[1:3]
4, 3,
3, 5]
3] 4] 2, 1]
x[::-1]
x[::2]
x[1:-1]
length of list
>>>

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

len(list)
length of list
len(list)

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

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

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

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

>>> x = [1, 2, 3, 4, 5]
>>> len(x)
5
>>> len(x[::2])
3
>>>
Tuple
>>>

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

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

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

Immutable List
Tuple

Immutable List

>>>
(1,
>>>
(1,
>>>

(1, ‘aaa’, 2)
‘aaa’, 2)
1, ‘aaa’, 2
‘aaa’, 2)
Tuple

Immutable List

>>>
(1,
>>>
(1,
>>>

(1, ‘aaa’, 2)
‘aaa’, 2)
1, ‘aaa’, 2
‘aaa’, 2)
x = (1, ‘aaa’, 2)
Tuple

Immutable List

>>>
(1,
>>>
(1,
>>>
>>>

(1, ‘aaa’, 2)
‘aaa’, 2)
1, ‘aaa’, 2
‘aaa’, 2)
x = (1, ‘aaa’, 2)
Tuple

Immutable List

>>>
(1,
>>>
(1,
>>>
>>>

(1, ‘aaa’, 2)
‘aaa’, 2)
1, ‘aaa’, 2
‘aaa’, 2)
x = (1, ‘aaa’, 2)
x[1] = 3
Tuple

Immutable List

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

Immutable List

Traceback=(most recent
>>> (1, ‘aaa’, 2)
x[1]
3
call last):
Traceback 2)
(1, ‘aaa’,(most recent
call last):
>>> 1, ‘aaa’, 2
File "<input>", line
1,File "<input>", line
(1,in <module>
‘aaa’, 2)
TypeError: ‘aaa’,
1, x <module>
>>>in = (1,'tuple' 2)
object does
TypeError: 'tuple'
>>> x[1] = 3not support
item assignment
object does not support
>>>
item assignment
Initialization / Conversion
>>>
Initialization / Conversion
>>> tuple([1, 2, 3])
Initialization / Conversion
>>> tuple([1, 2, 3])
(1, 2, 3)
>>>
Access Element
>>>
Access Element
>>> x = (1, 2, 3)
Access Element
>>> x = (1, 2, 3)
>>>
Access Element
>>> x = (1, 2, 3)
>>> x[1]
Access Element
>>> x = (1, 2, 3)
>>> x[1]
2
>>>
Access Element
>>> x = (1, 2, 3)
>>> x[1]
2
>>> a, b, c = x
Access Element
>>> x = (1, 2, 3)
>>> x[1]
2
>>> a, b, c = x
>>>
Access Element
>>>
>>>
2
>>>
>>>

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

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

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

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

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

a,
x[1](1, =
x =b, c 2,x3)
a
x[1]
a, b, c = x
b
a
a, b, c = x
a
c
b
b
c
length of tuple
>>>

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

len(tuple)
length of tuple
len(tuple)

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

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

>>> x = 1, 2, 3, 4, 5
>>> len(x)
5
>>>
Dictionary
key-value relation

key

value

>>>
Dictionary
key-value relation

key

value

>>>
Dictionary
key-value relation

key

value

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

key

value

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

key

value

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

key

value

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

key

value

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

key

value

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

key

value

>>>
>>>
>>>
>>>

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

key

value

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

key

value

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

key

value

>>> x = dict()
>>> x[‘abc’] = 123
>>> x[111] = ‘aaa’
>>> x
{‘abc’: 123, 111: ‘aaa’}
>>> {1: 20, 2: 30}
{1: 20, 2: 30}
>>>
Initialization / Conversion
>>>
Initialization / Conversion
>>> dict()
Initialization / Conversion
>>> dict()
{}
>>>
Initialization / Conversion
>>> dict()
{}
>>> dict(one=1, two=2)
Initialization / Conversion
>>> dict()
{}
>>> dict(one=1, two=2)
{‘one’: 1, ‘two’: 2}
>>>
Initialization / Conversion
>>> dict()
{}
>>> dict(one=1, two=2)
{‘one’: 1, ‘two’: 2}
>>> dict([('two', 2),
(‘one’: 1)])
Initialization / Conversion
>>> dict()
{}
>>> dict(one=1, two=2)
{‘one’: 1, ‘two’: 2}
>>> dict([('two', 2),
(‘one’: 1)])
{‘one’: 1, ‘two’: 2}
>>>
Initialization / Conversion
{}
>>> dict()
>>>
{} dict(one=1, two=2)
{‘one’: 1, ‘two’: 2}
>>> dict(one=1, two=2)
>>> dict([('two', 2}
{‘one’: 1, ‘two’: 2),
(‘one’: 1)])
>>> dict([('two', 2),
{‘one’: 1, ‘two’: 2}
(‘one’: 1)])
>>> dict({‘one’: 2}
{‘one’: 1, ‘two’:1,
‘two’: 2})
>>> dict({‘one’: 1,
Initialization / Conversion
{‘one’: 1,
{}
>>> dict() ‘two’: 2}
>>> dict([('two', 2),
{} dict(one=1, two=2)
(‘one’: 1, ‘two’: 2}
{‘one’: 1)])
>>> dict(one=1, two=2)
>>> dict([('two', 2}
{‘one’: 1, ‘two’: 2),
(‘one’: 1)])
>>> dict([('two',1,
dict({‘one’: 2),
‘two’: 1,
{‘one’: 1)])
(‘one’:2}) ‘two’: 2}
>>> dict({‘one’: 2}
{‘one’: 1, ‘two’:1,
‘two’: 2})
>>> dict({‘one’: 1,
number of dictionary
>>>

len(dict)
number of dictionary
len(dict)

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

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

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

>>> x = {‘one’: 1,
‘two’: 2}
>>> len(x)
2
>>>
Control
Condition
>>>
Condition
>>> x = 100
Condition
>>> x = 100
>>>
Condition
>>> x = 100
>>> if x > 100:
Condition
>>> x = 100
>>> if x > 100:
...
Condition
>>> x = 100
>>> if x > 100:
...
x = x + 10
Condition
>>> x = 100
>>> if x > 100:
...
x = x + 10
...
Condition
>>> x = 100
>>> if x > 100:
...
x = x + 10
... elif x < 100:
Condition
>>> x = 100
>>> if x > 100:
...
x = x + 10
... elif x < 100:
...
Condition
>>> x = 100
>>> if x > 100:
...
x = x + 10
... elif x < 100:
...
x = x - 10
Condition
>>> x = 100
>>> if x > 100:
...
x = x + 10
... elif x < 100:
...
x = x - 10
...
Condition
>>>
>>>
...
...
...
...

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

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

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

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

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

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

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

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

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

else if
Condition
>>>
>>>
...
...
...
...
...
...
>>>
0
>>>

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

no switch statement in Python
x

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

no do-while statement in Python
Traversal Sequence
>>>
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>>
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
...
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
...
print i
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
...
print i
...
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
...
print i
...
1
2
3
4
5
>>>
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
...
print i
...
1
2
3
4
5
>>>
Traversal Sequence
>>> x = [1, 2, 3, 4, 5]
>>> for i in x:
...
print i
...
1
2
3
4
5
>>>

must be a iterable object
Addition for Loop
skip remaining statement and
continue
continue loop
>>>
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
if i == 2:
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
if i == 2:
...
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
if i == 2:
...
continue
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
if i == 2:
...
continue
...
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
if i == 2:
...
continue
...
print i
Addition for Loop
skip remaining statement and
continue
continue loop
>>> for i in range(5):
...
if i == 2:
...
continue
...
print i
...
Addition for Loop
skip remaining statement and
continue
continue loop
...
>>> for ifin range(5):
i i == 2:
...
if icontinue
== 2:
...
print i
continue
...
print i
0
...
1
3
4
>>>
Addition for Loop
break
>>>

exit from loop
Addition for Loop
break

exit from loop

>>> for i in range(5):
Addition for Loop
break

exit from loop

>>> for i in range(5):
...
Addition for Loop
break

exit from loop

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

exit from loop

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

exit from loop

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

exit from loop

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

exit from loop

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

exit from loop

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

exit from loop

>>> for i in range(5):
...
if i == 2:
...
break
...
print i
...
0
1
>>>
Addition for Loop
else
>>>

do something after unbroken
loop
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
print i
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
print i
...
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
print i
... else:
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
print i
... else:
...
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
print i
... else:
...
print “done”
Addition for Loop
else

do something after unbroken
loop

>>> for i in range(3):
...
print i
... else:
...
print “done”
...
Addition for Loop
else

do something after unbroken
loop

...
>>> for i in range(3):
print i
... else:
print i
... else:
print “done”
...
print “done”
0
...
1
2
done
>>>
Standard I/O
Evaluated Input
input
>>>

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

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

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

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

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

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

read a string can be evaluated
return an evaluated object
Evaluated Input
read a string can be evaluated
return an evaluated object

input
>>>
1
1
>>>
1 +
3
>>>

input()

input()
2
input()
Evaluated Input
read a string can be evaluated
return an evaluated object

input
>>>
1
1
>>>
1 +
3
>>>
5.0

input()

input()
2
input()
/ 2
Evaluated Input
read a string can be evaluated
return an evaluated object

input
1
>>>
1
>>>
1
1 +
>>>
3
1 +
>>>
3
5.0
>>>
2.5
5.0
>>>

input()
input()
2
input()
2
input()
/ 2
input()
/ 2
Evaluated Input
read a string can be evaluated
return an evaluated object

input
1
>>>
>>>
1
>>>
1 +
3
1 +
>>>
>>>
3
1 +
5.0
>>>
3
2.5
5.0
>>>
>>>
2.5
5.0
>>>

input()
input()
2
input()
2
input()
input()
2
/ 2
input()
/ 2
input()
input()
/ 2
input()
Evaluated Input
input
1
>>> input()
>>> input()
1
>>> 2
1 + input()
3
1 + 2
>>> input()
>>> input()
3
1 + 2
5.0 / 2
>>> input()
3
2.5
5.0 / 2
>>> input()
>>>
2.5 input()
5.0 / 2
“aaa bbb”
>>> input()

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

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

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

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

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

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

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

read a string can be evaluated
return an evaluated object

2.5
5.0 /
3
1 + 2 2
>>> input()
2.5
3
>>>
1 2 input()
Traceback
“aaa
5.0 / 2
>>> 2bbb” (most recent call last):
1 + input()
‘aaa
“aaa
2.5
5.0 /bbb’
3 File2"<input>", line 1, in <module>
1 + 2bbb”
>>> input()
‘aaa
2.5
>>> input()
3 File "<string>", line 1
1 + 2bbb’
[1, 1
“aaa2,23]
5.0 /bbb”
>>> input()
3
[1,
‘aaa ^
“aaa bbb’
2.5 2,23]
5.0 /bbb”
>>> input()
SyntaxError:
[1,
‘aaa
>>> 2,23]
2.5 input() unexpected EOF while parsing
5.0 /bbb’
1 2
[1, bbb”
“aaa2, 3]
>>> input()
Raw Input
read a string
raw_input()
return a string
>>>
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
‘1’
>>>
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
‘1’
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
‘1’
>>> raw_input()
1 + 2
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
‘1’
>>> raw_input()
1 + 2
‘1 + 2’
>>>
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
‘1’
>>> raw_input()
1 + 2
‘1 + 2’
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
>>> raw_input()
1
‘1’
>>> raw_input()
1 + 2
‘1 + 2’
>>> raw_input()
5.0 / 2
Raw Input
read a string
raw_input()
return a string
1
>>> raw_input()
‘1’
1
>>>
‘1’ raw_input()
1 + 2
>>> raw_input()
‘1
1 ++22’
>>> 2’
‘1 +raw_input()
5.0 / 2
>>> raw_input()
‘5.0
5.0 //22’
>>>
Raw Input
read a string
raw_input()
return a string
‘1’
1
>>> raw_input()
>>>
‘1’ raw_input()
1
1 +
>>> 2
‘1’ raw_input()
‘1
1 + 22’
>>>+raw_input()
>>>
‘1 raw_input()
1 ++22’
5.0
>>> /2’
‘1 +raw_input()
2
‘5.0
5.0 //22’
>>> raw_input()
>>>
‘5.0raw_input()
5.0 //22’
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
‘1’
1
>>> raw_input()
>>>
‘1’ raw_input()
1
1 +
>>> 2
‘1’ raw_input()
‘1
1 + 22’
>>>+raw_input()
>>>
‘1 raw_input()
1 ++22’
5.0
>>> /2’
‘1 +raw_input()
2
‘5.0
5.0 //22’
>>> raw_input()
>>>
‘5.0raw_input()
5.0 //22’
“aaa bbb”
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
‘1’
1 + 2
>>> raw_input()
‘1
>>>
‘1’ 2’
1 +raw_input()
1 +
>>> 2
‘1’ raw_input()
5.0
‘1 / 2
1 + 22’
>>>+raw_input()
‘5.0
>>> /
‘1 raw_input()
1 ++22’2’
5.0
>>> /2’
‘1 +raw_input()
2
“aaa
‘5.0 bbb”
5.0 //22’
>>> raw_input()
‘“aaa bbb”’
>>>
‘5.0raw_input()
5.0 //22’
“aaa bbb”
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
‘1’
1 + 2
>>> raw_input()
‘1
>>>
‘1’ 2’
1 +raw_input()
1 +
>>> 2
‘1’ raw_input()
5.0
‘1 / 2
1 + 22’
>>>+raw_input()
‘5.0
>>> /
‘1 raw_input()
1 ++22’2’
5.0
>>> /2’
‘1 +raw_input()
2
“aaa
‘5.0 bbb”
5.0 //22’
>>> raw_input()
‘“aaa bbb”’
>>>
‘5.0raw_input()
5.0 //22’
“aaa bbb”
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
‘1
‘1’
1 + 22’
>>>+raw_input()
‘1
>>>
‘1’ 2’
1 +raw_input()
5.0
1 + /
>>> 2 2
‘1’ raw_input()
‘5.0
5.0
‘1 //2
1 + 22’2’
>>>+raw_input()
‘5.0
>>> /
‘1 raw_input()
1 ++22’2’
“aaa 2
5.0 bbb”
>>> /2’
‘1 +raw_input()
‘“aaa
“aaa bbb”’
‘5.0 bbb”
5.0 //22’
>>> raw_input()
‘“aaa bbb”’
>>>
‘5.0raw_input()
5.0 //22’
[1, bbb”
“aaa2, 3]
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
5.0
‘1
‘1’ / 2
1 + 22’
>>>+raw_input()
‘5.0
‘1
>>> /
‘1’ 2’2’
1 +raw_input()
5.0
1 + /
>>> 2 2
‘1’ raw_input()
“aaa
‘5.0
5.0 bbb”
‘1 //2
1 + 22’2’
>>>+raw_input()
‘“aaa
‘5.0
>>> /bbb”’
‘1 raw_input()
1 ++22’2’
“aaa 2
5.0 bbb”
>>> /2’
‘1 +raw_input()
[1,
‘“aaa 3]
“aaa bbb”
‘5.02,bbb”’
5.0 //22’
>>> raw_input()
‘[1,
‘“aaa bbb”’
>>> 2, 3]’
‘5.0raw_input()
5.0 //22’
[1, bbb”
“aaa2, 3]
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
5.0
‘1
‘1’ / 2
1 + 22’
>>>+raw_input()
‘5.0
‘1
>>> /
‘1’ 2’2’
1 +raw_input()
5.0
1 + /
>>> 2 2
‘1’ raw_input()
“aaa
‘5.0
5.0 bbb”
‘1 //2
1 + 22’2’
>>>+raw_input()
‘“aaa
‘5.0
>>> /bbb”’
‘1 raw_input()
1 ++22’2’
“aaa 2
5.0 bbb”
>>> /2’
‘1 +raw_input()
[1,
‘“aaa 3]
“aaa bbb”
‘5.02,bbb”’
5.0 //22’
>>> raw_input()
‘[1,
‘“aaa bbb”’
>>> 2, 3]’
‘5.0raw_input()
5.0 //22’
[1, bbb”
“aaa2, 3]
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
‘5.0
5.0
‘1
‘1’ //2
1 + 22’2’
>>>+raw_input()
‘5.0
‘1
>>> /
‘1’ 2’2’
1 +raw_input()
“aaa
5.0
1 + / 2
>>> 2bbb”
‘1’ raw_input()
‘“aaa
“aaa
‘5.0 bbb”’
5.0 bbb”
‘1 //2
1 + 22’2’
>>>+raw_input()
‘“aaa
‘5.0
>>> /bbb”’
‘1 raw_input()
1 ++22’2’
[1,
“aaa bbb”
5.0 2,2
>>> /2’3]
‘1 +raw_input()
‘[1,
[1,
‘“aaa2,3]
“aaa bbb”
‘5.02,bbb”’
5.0 //22’
>>> raw_input()
3]’
‘[1,
‘“aaa bbb”’
>>> 2, 3]’
‘5.0raw_input()
5.0 //22’
1 2
[1, bbb”
“aaa2, 3]
>>> raw_input()
Raw Input
read a string
raw_input()
return a string
“aaa
‘5.0
5.0 bbb”
‘1
‘1’ //2
1 + 22’2’
>>>+raw_input()
‘“aaa
‘5.0
‘1
>>> /bbb”’
‘1’ 2’2’
1 +raw_input()
“aaa
5.0
1 + / 2
>>> 2bbb”
‘1’ raw_input()
[1,
‘“aaa
“aaa
‘5.0 bbb”
5.0 2,bbb”’
‘1 //23]
1 + 22’2’
>>>+raw_input()
‘[1,
‘“aaa
‘5.0 2, 3]’
>>> /bbb”’
‘1 raw_input()
1 ++22’2’
[1,
“aaa bbb”
5.0 2,2
>>> /2’3]
‘1 +raw_input()
1 2
‘[1,
[1,
‘“aaa2,3]
“aaa bbb”
‘5.02,bbb”’
5.0 //22’
>>> raw_input()
3]’
‘1
‘[1,
‘“aaa bbb”’
>>> raw_input()
‘5.0/2, 3]’
5.02’/22’
1 2
[1, bbb”
“aaa2, 3]
>>> raw_input()
Output
print
>>>

print object to standard output
Output
print

print object to standard output

>>> print “Hello World!”
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>>
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>> print “Hello”, “World!”
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>> print “Hello”, “World!”
Hello World!
>>>
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>> print “Hello”, “World!”
Hello World!
>>> print 1 + 2
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>> print “Hello”, “World!”
Hello World!
>>> print 1 + 2
3
>>>
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>> print “Hello”, “World!”
Hello World!
>>> print 1 + 2
3
>>> print [1, 2, 3]
Output
print

print object to standard output

>>> print “Hello World!”
Hello World!
>>> print “Hello”, “World!”
Hello World!
>>> print 1 + 2
3
>>> print [1, 2, 3]
[1, 2, 3]
>>>
Custom Function
Define a Function
>>>
Define a Function
>>> def SQ(x):
Define a Function
>>> def SQ(x):
...
Define a Function
>>> def SQ(x):
...
return x * x
Define a Function
>>> def SQ(x):
...
return x * x
...
Define a Function
>>> def SQ(x):
...
return x * x
...
>>>
Define a Function
>>> def SQ(x):
...
return x * x
...
>>> SQ(10)
Define a Function
>>> def SQ(x):
...
return x * x
...
>>> SQ(10)
100
>>>
Define a Function
>>> def SQ(x):
...
return x * x
...
>>> SQ(10)
100
>>>
Define a Function
>>> def SQ(x):
...
return x * x
...
>>> SQ(10)
100
>>>

function name
Define a Function
>>> def SQ(x):
...
return x * x
...
>>> SQ(10)
100
>>>

function name

parameter
Define a Function
>>> def SQ(x):
...
return x * x
...
>>> SQ(10)
100
>>>

function name

parameter

function content
Lambda Function
>>>
Lambda Function
>>> CUBE = lambda k: k * k * k
Lambda Function
>>> CUBE = lambda k: k * k * k
>>>
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
1000
>>>
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
1000
>>> (lambda x, y: x * y)(3, 4)
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
1000
>>> (lambda x, y: x * y)(3, 4)
12
>>>
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
1000
>>> (lambda x, y: x * y)(3, 4)
12
>>>
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
1000
>>> (lambda x, y: x * y)(3, 4)
12
>>>

parameter
Lambda Function
>>> CUBE = lambda k: k * k * k
>>> CUBE(10)
1000
>>> (lambda x, y: x * y)(3, 4)
12
>>>

return value
parameter
Built-in Function
range
>>>
range
>>> range(10)
range
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>
range
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(3, 10)
range
>>>
[0,
>>>
[3,
>>>

range(10)
1, 2, 3, 4, 5, 6, 7, 8, 9]
range(3, 10)
4, 5, 6, 7, 8, 9]
range
>>>
[0,
>>>
[3,
>>>

range(10)
1, 2, 3, 4, 5, 6, 7, 8, 9]
range(3, 10)
4, 5, 6, 7, 8, 9]
range(1, 10, 2)
range
>>>
[0,
>>>
[3,
>>>
[1,
>>>

range(10)
1, 2, 3, 4, 5, 6, 7, 8, 9]
range(3, 10)
4, 5, 6, 7, 8, 9]
range(1, 10, 2)
3, 5, 7, 9]
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE
Python @NCKU CSIE

More Related Content

Similar to Python @NCKU CSIE

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)
Zoe Landon
 
Tonethatplone
TonethatploneTonethatplone
Tonethatplone
Paul Roeland
 
Python overview
Python overviewPython overview
Python overview
Haroon Karim
 
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)
Zoe Landon
 
Simple is better than complex. ~私がPythonを愛する理由~
Simple is better than complex. ~私がPythonを愛する理由~Simple is better than complex. ~私がPythonを愛する理由~
Simple is better than complex. ~私がPythonを愛する理由~
cocodrips
 
Zen and the Art of Python
Zen and the Art of PythonZen and the Art of Python
Zen and the Art of Python
Clayton Parker
 
Python - The Good, The Bad and The ugly
Python - The Good, The Bad and The ugly Python - The Good, The Bad and The ugly
Python - The Good, The Bad and The ugly
Eran Shlomo
 
Python 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGPython 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUG
NEWLUG
 
Accessibility in email - #EoAInsights
Accessibility in email - #EoAInsightsAccessibility in email - #EoAInsights
Accessibility in email - #EoAInsights
Mark Robbins
 
Talk about talks
Talk about talksTalk about talks
Talk about talks
Chris Sherry
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programmingAndre Leal
 
Dear compiler please don't be my nanny v2
Dear compiler  please don't be my nanny v2Dear compiler  please don't be my nanny v2
Dear compiler please don't be my nanny v2
Dino Dini
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth Version
Curtis Poe
 
A class action
A class actionA class action
A class action
Luciano Colosio
 
Naming Things (with notes)
Naming Things (with notes)Naming Things (with notes)
Naming Things (with notes)
Pete Nicholls
 
Programming methodology lecture03
Programming methodology lecture03Programming methodology lecture03
Programming methodology lecture03NYversity
 
Plague words or phrases
Plague words or phrasesPlague words or phrases
Plague words or phrasesSM Lalon
 

Similar to Python @NCKU CSIE (20)

Look beyond PHP
Look beyond PHPLook beyond PHP
Look beyond PHP
 
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)
 
Tonethatplone
TonethatploneTonethatplone
Tonethatplone
 
Python overview
Python overviewPython overview
Python overview
 
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)
 
Simple is better than complex. ~私がPythonを愛する理由~
Simple is better than complex. ~私がPythonを愛する理由~Simple is better than complex. ~私がPythonを愛する理由~
Simple is better than complex. ~私がPythonを愛する理由~
 
Introduction toprogramming
Introduction toprogrammingIntroduction toprogramming
Introduction toprogramming
 
Zen and the Art of Python
Zen and the Art of PythonZen and the Art of Python
Zen and the Art of Python
 
Python - The Good, The Bad and The ugly
Python - The Good, The Bad and The ugly Python - The Good, The Bad and The ugly
Python - The Good, The Bad and The ugly
 
Python 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUGPython 3 Intro Presentation for NEWLUG
Python 3 Intro Presentation for NEWLUG
 
Accessibility in email - #EoAInsights
Accessibility in email - #EoAInsightsAccessibility in email - #EoAInsights
Accessibility in email - #EoAInsights
 
Talk about talks
Talk about talksTalk about talks
Talk about talks
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Dear compiler please don't be my nanny v2
Dear compiler  please don't be my nanny v2Dear compiler  please don't be my nanny v2
Dear compiler please don't be my nanny v2
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth Version
 
A class action
A class actionA class action
A class action
 
Naming Things (with notes)
Naming Things (with notes)Naming Things (with notes)
Naming Things (with notes)
 
Programming methodology lecture03
Programming methodology lecture03Programming methodology lecture03
Programming methodology lecture03
 
Plague words or phrases
Plague words or phrasesPlague words or phrases
Plague words or phrases
 
Introducing XP
Introducing XPIntroducing XP
Introducing XP
 

More from Chih-Hsuan Kuo

Rust
RustRust
[Mozilla] content-select
[Mozilla] content-select[Mozilla] content-select
[Mozilla] content-select
Chih-Hsuan Kuo
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in Rust
Chih-Hsuan Kuo
 
在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。
Chih-Hsuan Kuo
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36
Chih-Hsuan Kuo
 
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
Chih-Hsuan Kuo
 
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
Chih-Hsuan Kuo
 
Necko walkthrough
Necko walkthroughNecko walkthrough
Necko walkthrough
Chih-Hsuan Kuo
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
Chih-Hsuan Kuo
 
面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!面試面試面試,因為很重要所以要說三次!
面試面試面試,因為很重要所以要說三次!
Chih-Hsuan Kuo
 
面試心得分享
面試心得分享面試心得分享
面試心得分享
Chih-Hsuan Kuo
 
Windows 真的不好用...
Windows 真的不好用...Windows 真的不好用...
Windows 真的不好用...
Chih-Hsuan Kuo
 
Introduction to VP8
Introduction to VP8Introduction to VP8
Introduction to VP8
Chih-Hsuan Kuo
 
[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree Isomorphism[ACM-ICPC] Tree Isomorphism
[ACM-ICPC] Tree IsomorphismChih-Hsuan Kuo
 
[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's AlgorithmChih-Hsuan Kuo
 
[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint Set[ACM-ICPC] Disjoint Set
[ACM-ICPC] Disjoint SetChih-Hsuan Kuo
 

More from Chih-Hsuan Kuo (20)

Rust
RustRust
Rust
 
[Mozilla] content-select
[Mozilla] content-select[Mozilla] content-select
[Mozilla] content-select
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in Rust
 
在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。在開始工作以前,我以為我會寫扣。
在開始工作以前,我以為我會寫扣。
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36
 
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
 

Recently uploaded

Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

Python @NCKU CSIE