introduction to python
TRANSCRIPT
Introduction to Python
Introduction to PythonYi-Fan Chu, 2016
Social Network ApplicationDepartment of Computer Science, University of Taipei
Introduction to Python
Overviews1.Introduction
2.Syntax
3.List and Dictionary
4.For loop
5.Implementation
Introduction to Python
Overviews1.Introduction
2.Syntax
3.List and Dictionary
4.For loop
5.Implementation
Introduction to Python
Semicolon is not needed.
Data type declaration is not needed.
Indented with logic
Syntax
Introduction to Python
Overviews1.Introduction
2.Syntax
3.List and Dictionary
4.For loop
5.Implementation
Introduction to Python
Data Structure to save data, just like “array”
With different index
List and Dictionary
Introduction to Python
[ ]
[1,2,3,4,5]
[ “abc”, ”def”, ”ghi”]
[1, ”abc”, 1.253, [1,2,3], {“xyz”:”hahaha”} ]
List
int string float list dictionary
Introduction to Python
Key-Value
Key : int, float, string
Value : int, float, string, list, dictionary
Dictionary
Introduction to Python
{ Key : Value }
{ “name” : “Apple”,
“color” : “red”,
“amonut” : 3 }
Dictionary
Key Value
Introduction to Python
List and Dictionary
[ “apple”, “red”, “3” ]
{ “fruit”:“apple”, “color”:“red”, “amount”:“3” }
Key : 0 1 2
Value: apple red 3
Key : fruit color amount
Value: apple red 3
Introduction to Python
Overviews1.Introduction
2.Syntax
3.List and Dictionary
4.For loop
5.Implementation
Introduction to Python
for( int i; i < 10; i++){
blah blah blah; }
For loop
for item in list/dictionary:
item = item + 1
C / Java
Python
With Condition
Without Condition
Introduction to Python
Overviews1.Introduction
2.Syntax
3.List and Dictionary
4.For loop
5.Implementation
Introduction to Python
ImplementationSetup environment
Making lists of number and strings
Try to use for loop
Making a directory of fruit
print something from directory