SlideShare una empresa de Scribd logo
1 de 132
Descargar para leer sin conexión
Python Fundamentals - Basic
給新⼿的 Python 程式設計 | WeiYuan
site: v123582.github.io
line: weiwei63
▪ 全端⼯程師 + 資料科學家
略懂⼀點網站前後端開發技術,學過資料探勘與機器
學習的⽪⽑。平時熱愛參與技術社群聚會及貢獻開源
程式的樂趣。
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
3
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
4
Introduction
▪The Zen of Python: Beautiful, Explicit, Simple
▪High-level and Interpreted programming language
▪Python 2.x or Python 3.x ?
▪Environment: `python --version`
▪Runtime: shell, command, jupyter/ipython, anaconda
▪Editor/IDE: sublime text, pycharm, spider(built in anaconda)
▪PIP: library manager of python
▪pyenv
5
6
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
7
Hello World
▪Encoding Declaration
▪Import Library
▪Variable and Assignment
▪Syntax
▪Indentation and Block
▪Input and Output (I/O)
▪Comment and Docstring
▪Function and Method
▪Expression and Operation
8
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# encoding: utf-8

import this

from keyword import kwlist

# ['False', 'None' . . .]

keywords = kwlist
if len(keywords) > 0:
print(keywords)


x = input("Input Something...")

print("%s", % (x))

help(print)
Hello World
▪Case Sensitivity
▪Weekly/Loosely Typed
9
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# encoding: utf-8

import this

from keyword import kwlist

# ['False', 'None' . . .]

keywords = kwlist
if len(keywords) > 0:
print(keywords)


x = input("Input Something...")

print("%s", % (x))

help(print)
Outline
▪Introduction
▪HelloWorld
▪Data Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
10
Common Types & Operator
▪Numeric type
• int, float, bool
• abs(), round()
▪String type
▪Container type
• list, tuple, dict, set
11
Common Types & Operator
▪Numeric type
• int, float, bool, complex
• abs(), round() => operator + operand
▪String type
▪Container type
• list, tuple, dict, set
12
▪expression = operator + operand (varibles)
• arithmetic, comparison
Common Types & Operator
▪Numeric type
• int, float, bool, complex
• abs(), round()
▪String type
▪Container type
• list, tuple, dict, set
13
▪expression = operator + operand (varibles)
• arithmetic, comparison
arithmetic
comparison
logical
bitwise
Common Types & Operator
▪Numeric type
• int, float, bool, complex
• abs(), round()
▪String type
▪Container type
• list, tuple, dict, set
14
1

2
3
4
5
6
7
8
9
10
a = 20
a, b, c, d = 20, 5.5, True, 4+3j
print(type(a)) # <class 'int'>
print(type(b)) # <class 'float'>
print(type(c)) # <class 'bool'>
print(type(d)) # <class 'complex'>
print(isinstance(a, int)) # True
print(isinstance(b, int)) # False
# True, False
Common Types & Operator
▪Numeric type
• int, float, bool, complex
• abs(), round()
▪String type
▪Container type
• list, tuple, dict, set
15
1

2
3
4
5
6
7
8
9
10
11
12
13
4 + 2
4.0 + 2
4.0 + 2.0
2 / 5
2.0 / 5
2 / 5.0
2.0 / 5.0
2 // 5
2 % 5
int(4.0)
float(4)
Common Types & Operator
▪Numeric type
• int, float, bool, complex
• abs(), round()
▪String type
▪Container type
• list, tuple, dict, set
16
1

2
3
4
5
6
7
8
9
10
11
# python2
w = 49
h = 163
bmi = 49 / (163/100)**2
print(bmi) # 49
# python3
w = 49.0
h = 163.0
bmi = 49 / (163/100)**2
print(bmi) # 18.4425...
Try it!
▪#練習:Set the following variables to the corresponding values:
1. my_int to the value 7
2. my_float to the value 1.23
3. my_bool to the value True
17
Try it!
▪#練習:計算下列運算:

18
1

2
3
4
5
6
7
8
9
10
11
1 + 3*2 # 7
1 + 3**2 # 10
(1 + 3)*2 # 8
1 + 3 / 2 *2 # 1
1 + 3 // 2 *2 # 1
1 + 3 / 2 **2 # 1
1 + 3 // 2 **2 # 1
int(1 + 3 / 2 *2) # 1
flaot(1 + 3 // 2 **2) # 1.0
Try it!
▪#練習:Add two Numbers 

19
1

2
3
4
5
6
7
8
9
10
11
a = input()
b = input()
…
print('The sum of ‘, a, ‘and’ ,b ,’is’, a + b)
Try it!
▪#練習:Add two Numbers 

20
1

2
3
4
5
6
7
8
9
10
11
a = input()
b = input()
…
print('The sum of ‘, a + b, ‘and’ ,a ,’is’, b)
print('The sum of %s and %s is %s ' % (a, b, sum))
print('The sum of {0} and {1} is {2} '.format(a, b, sum))
sum = int(a) + int(b)
print(f'The sum of {a} and {b} is {sum}')
Try it!
▪#練習:Find the Square Root 

21
1

2
3
4
5
6
7
8
9
1
0
1
1
num = 9
num_sqrt = 3
print('The square root of %0.3f is %0.3f' % (num ,num_sqrt))
Common Types & Operator
▪Numeric type
• int, float, bool, complex
▪String type
• len()
• lower(), upper()
• split(), find(), replace()
• slice
• Formatting String
▪Container type
• list, tuple, dict, set
22
1

2
3
4
5
6
7
8
a = '12345'
b = 'hello world'
c = 'n'
d = r'n'
e = 'n'
print(b + str(a) + c + d + e)
print(b + str(a) + str(c) + str(d) +
str(e))
▪Question:What is different among True, ‘True’, true ?
23
Try it!
▪#練習:Write a Python program to find the first appearance of
the substring 'not' and 'poor' from a given string, if 'bad' follows
the 'poor', replace the whole 'not'...'poor' substring with 'good'.
Return the resulting string.
• Sample Input: The lyrics is not that poor!
• Sample Output: The lyrics is good!
24
Try it!
▪#練習:⼀個網址的結構⼤概如圖所⽰,試著⽤ Python 分別把每
個值取出來。
25
Formatting String
▪Numeric type
• int, float, bool, complex
▪String type
• len(), lower(), upper(), split()
• Formatting String
▪Container type
26
1

2
3
4
5
6
7
8
9
10
a, b, sum = 2, 3, 5
'%s + %s = %s ' % (a, b, sum)
'{} + {} = {} '.format(a, b, sum)
'{x} + {y} = {z} '.format(x=a, y=b,
z=sum)
f'The sum of {a} and {b} is {sum}'
Formatting String
▪Numeric type
• int, float, bool, complex
▪String type
• len(), lower(), upper(), split()
• Formatting String
▪Container type
27
1

2
3
4
5
6
7
a, b, sum = 2, 3, 5
'%s + %s = %s ' % (a, b, sum)
'%d + %d = %d ' % (a, b, sum)
'%f + %f = %f ' % (a, b, sum)
Formatting String
▪Numeric type
• int, float, bool, complex
▪String type
• len(), lower(), upper(), split()
• Formatting String
▪Container type
28
1

2
3
4
5
6
7
a, b, c = ‘x’, ‘y’, ‘z’
'%s, %s, %s ' % (a, b, c)
'%d, %d, %d ' % (a, b, c)
'%f, %f, %f ' % (a, b, c)
Formatting String
▪Numeric type
• int, float, bool, complex
▪String type
• len(), lower(), upper(), split()
• Formatting String
▪Container type
29
1

2
3
4
5
6
7
a, b, sum = 20.12, 30.123, 50.243
'%s + %s = %s ' % (a, b, sum)
'%5d + %6d = %7d ' % (a, b, sum)
'%5.1f + %6.2f = %8.3f ' % (a, b,
sum)
Formatting String
▪Numeric type
• int, float, bool, complex
▪String type
• len(), lower(), upper(), split()
• Formatting String
▪Container type
30
1

2
3
4
5
6
7
%s => string
%d => decimal
%f => float
n => new line
t => tab
▪Question:What is Formatting String?
31
Common Types & Operator
▪Numeric type
• int, float, bool, complex
▪String type
▪Container type
• list [,] => mutable sequence # a = [1, 2, 3, 4], a[0] = 999
• tuple (,) => immutable sequence # b = (1, 2), b[0] = 999
• dict {:,} => mutable unordered collection of key-value mapped element
• set {,} => mutable unordered collections of unique elements
32
list
33
1

2
3
4
5
6
L = [1, 2, 3, 4]
G = [3, 4, 5, 6]
L + G # [1, 2, 3, 4, 3, 4, 5, 6]
L – G # 不存在
L * 2 # [1, 2, 3, 4, 1, 2, 3, 4]
L / 2 # 不存在
▪Question:How does arithmetical operation with string?
34
list
35
1

2
3
4
5
6
7
8
9
10
11
12
13
14
my_list = [2] # [2]
my_list.append(2) # [2, 2]
my_list.extend([2]) # [2, 2, 2]
my_list.insert(0, 3) # [3, 2, 2, 2]
my_list.pop() # [3, 2, 2]
my_list.remove(2) # [3, 2]
my_list.sort() # [2, 3]
my_list.reverse() # [3, 2]
my_list[::-1] # [2, 3]
len(my_list) # 2
sum(my_list) # 5
my_list.count(2) # 1
', '.join(my_list) # '2, 3'
Try it!
▪#練習:有⼀一個列列表,其中包括 10 個元素,例例如這個列列表是 [1,
2, 3, 4, 5, 6, 7, 8, 9, 0],要求將最右邊的 0 移到最左邊,結果會
變成 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

36
Try it!
▪#練習:有⼀一個列列表,其中包括 10 個元素,例例如這個列列表是 [1,
2, 3, 4, 5, 6, 7, 8, 9, 0],要求將最左邊的 1 移到最右邊,結果會
變成 [2, 3, 4, 5, 6, 7, 8, 9, 0, 1]

37
Try it!
▪#練習:Write a Python program to replace the last element in a
list with another list.
• Sample Input: num1 = [1, 3, 5, 7, 9, 10], num2 = [2, 4, 6, 8]
• Sample Output: [1, 3, 5, 7, 9, 2, 4, 6, 8]

38
tuple
39
1

2
(a, b) = my_list
(a, b) = (b, a)
Try it!
▪#練習:Swap Two Variables

40
dict
41
1

2
3
4
5
6
7
8
9
10
11
12
my_dict = {'Mark': 1, 'test': 0}
print(my_dict[’Mark’]) # 1
print(my_dict[0])
my_dict['Mary'] = 2 # {'Mark': 1, 'test': 0, ‘Mary’: 2}
del my_dict['test']
my_dict.items()
# dict_items([('Mark', 1), ('Mary', 2) ])
my_dict.keys()
# dict_keys(['Mark', 'Mary'])
my_dict.values()
# dict_values([1, 2])
dict
42
1

2
3
4
5
6
7
8
9
10
my_dict['Tom']
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# KeyError: 'openhome’
my_dict.get('Tom', ''), my_dict
# '', {'Mark': 1, 'test': 0}
my_dict.setdefault('Tom', 3), my_dict
# 3, {'Tom': 3, 'Mark': 1, 'test': 0}
Try it!
▪#練習:Write a Python program to concatenate following
dictionaries to create a new one.
43
1

2
3
4
5
6
7
8
9
10
# Input:
dic1={1:10, 2:20}
dic2={3:30, 4:40}
dic3={5:50, 6:60}
# Output: {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
Try it!
▪#練習:Write a Python program to check if a given key already
exists in a dictionary.
44
1

2
3
4
5
6
7
8
9
10
# Input:
d = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
key = input()
# Output: Yes, the key is in this dict. or
# No, the key is not in this dict.
set
45
1

2
3
4
5
6
7
8
9
10
admins = {'admin'}
users = {'admin', 'user1', 'user2'}
'Justin' in admins # False
admins & users # {'admin'}
admins | users # {'admin', 'user1', 'user2'}
admins - users # {}
users – admins # {‘user1’, ‘user2’}
admins ^ users # {user1, user2}
Try it!
▪#練習:Illustrate Different Set Operations
46
1

2
3
4
5
6
7
8
9
10
# define three sets
E, N = {0, 2, 4, 6, 8}, {1, 2, 3, 4, 5}
print("Intersection of E and N is", E & N) # 2, 4
print("Union of E and N is",E | N) # 0 1 2 3 4 5 6 8
print("Difference of E and N is",E - N) # 1 3 5

print("Symmetric difference of E and N is",E ^ N) # 0 1 3 5
6 8
Try it!
▪#練習:Remove the repeated elements from the list, and sort it
Decreasingly.
47
1

2
3
4
5
6
7
8
9
10
l = [1, 1, 3, 9, 7, 8, 8, 8]
# Output: [9, 8, 7, 3, 1]
48
▪Mutable objects
• list, dict, set
▪Immutable objects
• int, float, complex, string, tuple

Reference: https://www.linkedin.com/pulse/mutable-vs-immutable-objects-python-megha-mohan
Im vs Mutable ?
49Reference: https://www.linkedin.com/pulse/mutable-vs-immutable-objects-python-megha-mohan
tuple vs list?
▪slower but more powerful than tuples.
▪Lists can be modified, and they have lots of handy operations
we can perform on them.
▪Tuples are immutable and have fewer features.
▪To convert between tuples and lists use the list() and tuple()
functions:
• li = list(tu)
• tu = tuple(li)
50
iterator, iterable, iteration
51Reference: http://nvie.com/posts/iterators-vs-generators/
iterator, iterable, iteration
52
1

2
3
4
5
6
7
8
9
10
11
12
13
14
list = [1, 2, 3]
iterator = iter(list)
import sys
sys.getsizeof(list)
sys.getsizeof(iterator)
for i in list:
print(i)
for i in iterator:
print(i)
print(next(iterator))
iterator, iterable, iteration
53
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
def f():
i = 1
return i
def g():
i = 1
yield i
i = 2
yield i
a = f()
b = g()
print(a)
print(next(b))
bulit-in method
54
1

2
3
4
5
6
7
8
dir(list)
# ['append', 'clear', 'copy', 'count', 'extend',
'index',# 'insert', 'pop', 'remove', 'reverse', 'sort']
help(list.extend)
# extend(...)
# L.extend(iterable) -> None
# extend list by appending elements from the iterable
Reference: https://docs.python.org/3/library/functions.html
Try it!
▪#練習:要求使⽤者輸⼊ n ,印出從 n 平⽅的對數值(Log)
• hint:引入⼀一個 math 的函式庫,並且利利⽤用 dir  與 math 查看 log 函式怎
麼使⽤用
55
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
56
Flow Control
▪if - elif - else
▪while
▪for in
▪break, continue
▪range(), zip(), enumerate()
57
Common Types & Operator
▪Numeric type
• int, float, bool, complex
• expression => operator + operand
▪String type
▪Container type
• list, tuple, dict, set
58
▪expression = operator + operand (varibles)
• arithmetic, comparison
arithmetic
comparison
logical
bitwise
Flow Control
▪Logical Operator
▪Comparison Operator
59
1

2
3
3 is 2, 3 is not 2
True and False, True or False
3 in [1, 2, 3, 4]
1 2 > 2, 2 >= 2, 2 == 2, 2 != 2
Flow Control
▪Logical Operator => return Boolean
▪Comparison Operator => return Boolean
60
1

2
3
3 is 2, 3 is not 2
True and False, True or False
3 in [1, 2, 3, 4]
1 2 > 2, 2 >= 2, 2 == 2, 2 != 2
What it truth?
61
What it truth?
62
Flow Control
▪if - elif - else
▪while
▪for in
▪break, continue
▪range(), zip(), enumerate()
63
1

2
3
4
5
6
7
8
9
if condition:
...
elif condition:
...
else:
...
a = ... if condition else ...
64Reference: http://swcarpentry.github.io/training-course/2013/03/concept-map-conditional-statements-
▪operator
• boolean/logical
• comparison
Flow Control
▪if - elif - else
▪while
▪for in
▪break, continue
▪range(), zip(), enumerate()
65
1

2
while condition:
....
Flow Control
▪if - elif - else
▪while
▪for in
▪break, continue
▪range(), zip(), enumerate()
66
1

2
3
4
5
for i in [...]:
...
a = [i for i in [...]] # list
b = (i for i in [...]) # generator
Try it!
▪#練習:有⼀一個列列表,其中包括 10 個元素,例例如這個列列表是 [1,
2, 3, 4, 5, 6, 7, 8, 9, 0],要求將列列表中的每個元素⼀一次向前移動⼀一
個位置,第⼀一個元素到列列表的最後,然後輸出這個列列表。最終樣
式是 [2, 3, 4, 5, 6, 7, 8, 9, 0, 1],如果要把偶數放前⾯,奇數放後
⾯該怎麼做?結果像是 [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]



67
Try it!
▪#練習:在數學中,⽤用 n! 來來表⽰示階乘,例例如,4! =1×2×3×4
=24。請寫⼀一個程式,讓使⽤用者輸入 n,印出 n!
1. ⽤用 for 迴圈完成
2. ⽤用 while 迴圈完成
68
Try it!
▪#練習:如果將⼀句話作為⼀個字符串,那麼這個字符串中必然
會有空格(這裡只是討論英⽂),⽐如“How are you?”,但有
的時候,會在兩個單詞之間多⼤⼀個空格。現在的任務是,如果
⼀個字符串中有連續的兩個空格,請把它刪除。
69
Try it!
▪#練習:"Please count the character here."

70
1

2
3
4
5
6
7
8
9
10
# {'r': 3, 'c': 3, 't': 3, ' ': 4, 'n': 1, 'u': 1, 'h': 3,
'e': 6, 'l': 1, 'o': 1, 'a': 3, 's': 1, 'P': 1, '.': 1}
Try it!
▪#練習:"Here are UPPERCASE and lowercase chars."

71
1

2
3
4
5
6
7
8
9
10
# {'c': ['c', 'c'], 'R': ['R'], 'w': ['w'], ' ': [' ', ' ',
' ', ' ', ' '], '.': ['.'], 'n': ['n'], 'H': ['H'], 'P':
['P', 'P'], 'h': ['h'], 'S': ['S'], 'e': ['e', 'e', 'e',
'e', 'e'], 'l': ['l'], 'E': ['E', 'E'], 'U': ['U'], 'a':
['a', 'a', 'a', 'a'], 'A': ['A'], 'o': ['o'], 'C': ['C'],
'r': ['r', 'r', 'r', 'r'], 'd': ['d'], 's': ['s', 's']}
Try it!
▪#練習:畫各種三⾓形與變形

72
*
**
***
****
    *
   **
  ***
 ****
      *
    ***
    *****
  *******
     *
    ***
   *****
  *******
 *********
  *******
   *****
    ***
     *
▪https://leetcode.com/problems/two-sum/description/
73
Flow Control
▪if - elif - else
▪while
▪for in
▪break, continue
▪range(), zip(), enumerate()
74
Flow Control
▪if - elif - else
▪while
▪for in
▪break, continue
▪range(), zip(), enumerate()
75
1

2
3
4
5
6
7
8
for i in range(1, 3):
print(i)
for i, j in zip([a, b, c], [1, 2, 3]):
print(i, j)
for i,j in enumerate([a, b, c]):
print(i, j)
More zip() …
76
1

2
3
4
5
6
7
8
9
10
result1 = [2, 4, 6, 8]
result2 = [11, 13, 15, 17]
for i, j in zip(result1, result2)
print(i + j)
# 2 11
# 4 13
# 6 15
# 8 17
More zip() …
77
1

2
3
4
5
6
7
8
9
10
11
12
13
result3 = [(2, 11), (4, 13), (6, 15), (8, 17)]
for i in zip(*result3):
print(i)
# (2, 4, 6, 8)
# (11, 13, 15, 17)
for i in map(list,zip(*result3)):
print(i)
# [2, 4, 6, 8]
# [11, 13, 15, 17]
Try it!
▪#練習:建⽴⼀個 1 - 10 平⽅的數列。

78
Try it!
▪#練習:有兩個列表,分別是:a = [1,2,3,4,5],b = [9,8,7,6,5],
要計算這兩個列表中對應元素的和。
79
Try it!
▪#練習:有⼀個字典 ,myinfor =
{"name":"qiwsir","site":"qiwsir.github.io","lang":"python"}, 將這
個字典變換成 :infor =
{"qiwsir":"name","qiwsir.github.io":"site","python":"lang"}
80
Try it!
▪#練習:按照下⾯的要求實現對列表的操作,產⽣⼀個列表,其
中有40個元素,每個元素是0到100的⼀個隨機整數如果這個列表
中的數據代表著某個班級40⼈的分數,請計算成績低於平均分的
學⽣⼈數,並輸出對上⾯的列表元素從⼤到⼩排序
81
Try it!
▪#練習:承上題,想要對分數進⾏調整,不及格的⼈將原始分數
開根號乘以⼗(但最⾼不可以超過 60 分),及格者不變。

82
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
83
Function
84
1

2
3
4
5
6
7
8
9
max1 = a if a > b else b...
max2 = x if x > y else y...
a = 123
b = 234
// declare funcetion
def max(a, b):
return a if a > b else b
// call function
max(10, 20)
maximum = max
maximum(10, 20)
# 20
Basic Method for Call Function
85
1

2
3
4
5
6
7
def f(x=100, y=200):
return x, y
f(1, 2)
f(y=2, x=1)
f(*(1, 2))
f(**{y=2, x=1})
Try it!
▪#練習:寫⼀個計算平⽅的函式。

86
Try it!
▪#練習:寫⼀個計算平⽅根的函式。



87
Try it!
▪#練習:寫⼀個回傳⼀次⽅,⼆次⽅,…,到指定次⽅的函式。
88
*args
89
1

2
3
4
5
6
7
8
9
10
def foo(*args):
print(args)
foo(1,2,3) # (1, 2, 3)
foo("qiwsir","qiwsir.github.io","python")
# ('qiwsir', 'qiwsir.github.io', 'python')
foo("qiwsir",307,["qiwsir",2],{"name":"qiwsir"})
# ('qiwsir', 307, ['qiwsir', 2], {'lang': 'python'})
**kargs
90
1

2
3
4
5
def foo(**kargs):
print(kargs)
foo(a=1,b=2,c=3)
# {'a': 1, 'c': 3, 'b': 2}
type1 + type2 + type3
91
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
def foo(x,y,z,*args,**kargs):
print(x)
print(y)
print(z)
print(args)
print(kargs)
foo('qiwsir',2,"python")
# qiwsir# 2 # python# ()# {}
foo(1,2,3,4,5)
# 1# 2# 3# (4, 5)# {}
foo(1,2,3,4,5,name="qiwsir")
# 1# 2# 3# (4, 5)# {'name': 'qiwsir'}
92Reference: http://swcarpentry.github.io/training-course/2013/05/concept-map-python-functions/
Try it!
▪#練習:以下程式會如何輸出?
93
1

2
3
4
5
6
7
8
9
10
11
12
def foo(x,y=‘hello’,*targs,**dargs):
    print "x==>",x
    print "y==>",y
    print "targs_tuple==>",targs
    print "dargs_dict==>",dargs
 


foo("1x")
foo("1x","2y")
foo("1x","2y","3t1","3t2")
foo("1x","2y","3t1","3t2",d1="4d1",d2="4d2")
Try it!
▪#練習:寫⼀個輸⼊ N 個數字,回傳總和的函式。



94
Try it!
▪#練習:印出 1~100 有哪些質數

95
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
96
Software Engineering
97
Procedural
Programming
Modular
Programming
Objective Orient
Programming
Functional
Programming
Software Engineering
98
Modular
Programming
Objective Orient
Programming
Class and Object
99
100
abstract
instance
101
class object
102
class object
State
Behavior
103
class object
Properties
method
OOP Concept
▪Abstraction
▪Encapsulation => public, private
▪Inheritance
▪Polymorphism => 不同的類別,有相同的 method
▪Overloading => ⼀一個類別中相同的 method ,有不同的⾏行行為
▪Overriding => ⽗父⼦子相同的 method,改寫成不同的⾏行行為
104
Inheritance
▪base classes
▪derived class
105
Class Objects
106
1

2
3
4
5
6
7
8
class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return 'hello world %s' % (self.i)
Class Objects
107
1

2
3
4
5
6
7
8
class MyClass:
"""A simple example class"""
def __init__(self, i):
self.i = i
def f(self):
return 'hello world %s' % (self.i)
Class and Object
108
1

2
3
4
5
6
7
8
class Animal:
  def __init__(self, name):
    self.name = name
  def call():
    return ‘汪汪’
a = Animal('動物')
print(a.name)
print(a.call())
109
1

2
3
4
5
6
7
8
9
10
class BankAccount:
type = 'Normal Account'
def __init__(self, name):
self.userName = name
self.balance = 0.0
def __str__(self):
return self.name
11

12
13
14
15
16
17
18
19
20
21
22
def showBalance(self):
print self.balance
return
def withdrawMoney(self, amount):
self.balance -= amount
self.check()
return
def depositMoney(self, amount):
self.balance += amount
return
def check()
Creating a Class
110
1

2
3
4
5
6
7
8
9
10
object1 = BankAccount("Im 1")
object1.userName
object1.depositMoney(100)
print object1.balance
object1.showBalance()
print object1.type
Create an Object
1

2
3
4
5
6
7
8
9
10
object2 = BankAccount("Im 2")
object2.userName
object2.depositMoney(200)
print object2.balance
object2.showBalance()
print object2.type
111
1

2
3
4
5
6
7
8
9
10
account3 = BankAccount()
print(account3.__class__)
print(type(account3))
string = 'Cat'
print(string.__class__)
print(type(string))
Create an Object
Try it!
▪#練習:建⽴⼀個 Student 的類別,要包含姓名、性別、年齡,
也要可以修改資料。
▪class student()
▪ det __init__(self, name, sex, age):
▪ selt.name = name.
▪…
112
Try it!
▪#練習:利⽤上述建⽴的類別,宣告幾個物件,並放到⼀個 dict
保存。
▪TomObj = student(‘Tom’, ‘male’, 22)
▪stduents = {‘Tom’: TomObj , ‘Mary’: obj}
▪stduents.Tom.age
▪stduents.Mary.age
113
OOP Concept
▪Abstraction
▪Encapsulation => public, private
▪Inheritance
▪Polymorphism => 不同的類別,有相同的 method
▪Overloading => ⼀一個類別中相同的 method ,有不同的⾏行行為
▪Overriding => ⽗父⼦子相同的 method,改寫成不同的⾏行行為
114
Inherit
115
1

2
3
4
5
6
7
8
9
1
0
class Dog(Animal):
  def __init__(self, name, age):
    super().__init__(name)
    self.age = age
# override
  def call():
    print('汪汪汪')
def call(ishungry):
    print(’T____T')


d = Dog('⼩小⽩白', 13)
print(d.name)
1

2
3
4
5
6
7
8
class Animal:
  def __init__(self, name):
    self.name = name
  def call():
    return ‘汪汪’
a = Animal('動物')
print(a.name)
print(a.call())
Inherit
116
1

2
3
4
5
6
7
8
9
1
0
class Cat(Animal):
  def __init__(self, name, age):
    super().__init__(name)
    self.age = age
# override
  def call():
    print(’喵喵喵')


d = Dog(‘⼩小花', 13)
print(d.name)
1

2
3
4
5
6
7
8
class Animal:
  def __init__(self, name):
    self.name = name
  def call():
    return ‘汪汪’
a = Animal('動物')
print(a.name)
print(a.call())
Inherit
117
1

2
3
4
5
6
7
8
9
10
class ExecutiveAccount( BankAccount ):
def requestCredit(self, amount):
self.balance += amount
executive = ExecutiveAccount()
OOP Concept
▪Abstraction
▪Encapsulation => public, private
▪Inheritance
▪Polymorphism => 不同的類別,有相同的 method
▪Overloading => ⼀一個類別中相同的 method ,有不同的⾏行行為
▪Overriding => ⽗父⼦子相同的 method,改寫成不同的⾏行行為
118
Private
119
1

2
3
4
5
6
7
8
9
10
class Human:
def __init__(self,h=0,w=0):
self.height=h
self.weight=w
def BMI(self):
return self.weight / ((self.height/100)**2)
a = Human(180,80)
print(a.height,a.weight)
print(a.BMI())
Private
120
1

2
3
4
5
6
7
8
9
10
class Human:
def __init__(self,h=0,w=0):
self.__height=h
self.__weight=w
def __BMI(self):
return self.__weight /
((self.__height/100)**2)
a = Human(180,80)
print(a.__height,a.__weight)
print(a.__BMI())
Private
121
1

2
3
4
5
6
7
8
9
10
class Human:
def __init__(self,h=0,w=0):
self.__height=h
self.__weight=w
def __BMI(self):
return self.__weight /
((self.__height/100)**2)
def getBMI(self):
return self.__BMI()
a = myclass.Human(180,80)
print(a.getBMI())
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
122
Error Exception
123
1

2
3
4
5
6
7
8
9
10
11
12
13
14
10 * (1/0)
4 + spam*3
'2' + 2
Error Exception
124
1

2
3
4
5
6
7
8
9
10
11
12
13
14
10 * (1/0)
# Traceback (most recent call last):
#   File "<stdin>", line 1, in
<module>ZeroDivisionError: division by zero
4 + spam*3
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>NameError:
name 'spam' is not defined
'2' + 2
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>TypeError:
Can't convert 'int' object to str implicitly
try-except
125
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
try:
    x = input("the first number:")
    y = input("the second number:")
    r = float(x)/float(y)
    print(r)
except Exception as e:
    print(e)
        
the first number: 2
the second number: 0
# float division by zero
the first number: 2
the second number: a
# could not convert string to float: a
the first number: 4
the second number: 2
# 2.0
Finally
126
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
try:
    do something
except:
    raise NameError('HiThere')
    do something
finally
    do something
try:
    file = open("test.py")
except:
    print('Read file error')
finally:
    file.close()
Outline
▪Introduction
▪HelloWorld
▪Common Types & Operator
▪Flow Control
▪Function
▪Class
▪Exception
▪File IO
127
File Write
128
1

2
3
fh = open("example.txt", "w")
fh.write(”hello world")
fh.close()
File Read
129
1

2
3
fh = open("example.txt", ”r")
fh.read()
fh.close()
With
130
1

2
3
4
5
with open("example.txt", "w") as fh:
    fh.write(”hello world")
with open("example.txt", "r") as fh:
    fh.read()
mode
131
r 以只读⽅式打开⽂件。⽂件的指针将会放在⽂件的开头。这是默认模式。
r+ 打开⼀个⽂件⽤于读写。⽂件指针将会放在⽂件的开头。
w 打开⼀个⽂件只⽤于写⼊。如果该⽂件已存在则将其覆盖。如果该⽂件不存
在,创建新⽂件。
w+ 打开⼀个⽂件⽤于读写。如果该⽂件已存在则将其覆盖。如果该⽂件不存
在,创建新⽂件。
a 打开⼀个⽂件⽤于追加。如果该⽂件已存在,⽂件指针将会放在⽂件的结
尾。也就是说,新的内容将会被写⼊到已有内容之后。如果该⽂件不存在,
创建新⽂件进⾏写⼊。
a+ 打开⼀个⽂件⽤于读写。如果该⽂件已存在,⽂件指针将会放在⽂件的结
尾。⽂件打开时会是追加模式。如果该⽂件不存在,创建新⽂件⽤于读写。
Thanks for listening.
2017/08/07 (Tue.) Fundamental Python - Basic
Wei-Yuan Chang
v123582@gmail.com
v123582.github.io

Más contenido relacionado

La actualidad más candente

Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)James Titcumb
 
Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)Damien Seguy
 
Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)James Titcumb
 
Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)James Titcumb
 
Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)James Titcumb
 
Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)James Titcumb
 
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)James Titcumb
 
Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Paulo Morgado
 
Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)James Titcumb
 
Elixir formatter Internals
Elixir formatter InternalsElixir formatter Internals
Elixir formatter InternalsPedro Medeiros
 
PHP for Python Developers
PHP for Python DevelopersPHP for Python Developers
PHP for Python DevelopersCarlos Vences
 
ScotRuby - Dark side of ruby
ScotRuby - Dark side of rubyScotRuby - Dark side of ruby
ScotRuby - Dark side of rubyGautam Rege
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfacesmelpon
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parserkamaelian
 
Exhibition of Atrocity
Exhibition of AtrocityExhibition of Atrocity
Exhibition of AtrocityMichael Pirnat
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2Marc Gouw
 

La actualidad más candente (20)

Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)
 
Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)
 
Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)
 
Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
 
Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)
 
Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)
 
Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)
 
Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)
 
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
 
Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7
 
Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)
 
Elixir formatter Internals
Elixir formatter InternalsElixir formatter Internals
Elixir formatter Internals
 
PHP for Python Developers
PHP for Python DevelopersPHP for Python Developers
PHP for Python Developers
 
ScotRuby - Dark side of ruby
ScotRuby - Dark side of rubyScotRuby - Dark side of ruby
ScotRuby - Dark side of ruby
 
Arrows in perl
Arrows in perlArrows in perl
Arrows in perl
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfaces
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
 
Exhibition of Atrocity
Exhibition of AtrocityExhibition of Atrocity
Exhibition of Atrocity
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2
 

Similar a Python Fundamentals - Basic

Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanPython fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanWei-Yuan Chang
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsMichael Pirnat
 
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016Codemotion
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesMatt Harrison
 
Python for High School Programmers
Python for High School ProgrammersPython for High School Programmers
Python for High School ProgrammersSiva Arunachalam
 
Happy Go Programming
Happy Go ProgrammingHappy Go Programming
Happy Go ProgrammingLin Yo-An
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhDIVYA SINGH
 
pa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processingpa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text ProcessingRodrigo Senra
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In RubyRoss Lawley
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7decoupled
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiaritiesnoamt
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscationguest9006ab
 
Python Usage (5-minute-summary)
Python Usage (5-minute-summary)Python Usage (5-minute-summary)
Python Usage (5-minute-summary)Ohgyun Ahn
 

Similar a Python Fundamentals - Basic (20)

Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanPython fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
 
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
How to avoid Go gotchas - Ivan Daniluk - Codemotion Milan 2016
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Python for High School Programmers
Python for High School ProgrammersPython for High School Programmers
Python for High School Programmers
 
Python slide
Python slidePython slide
Python slide
 
Happy Go Programming
Happy Go ProgrammingHappy Go Programming
Happy Go Programming
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 
Vcs16
Vcs16Vcs16
Vcs16
 
Python: The Dynamic!
Python: The Dynamic!Python: The Dynamic!
Python: The Dynamic!
 
pa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processingpa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processing
 
Thinking Functionally In Ruby
Thinking Functionally In RubyThinking Functionally In Ruby
Thinking Functionally In Ruby
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Python.pdf
Python.pdfPython.pdf
Python.pdf
 
Python Puzzlers
Python PuzzlersPython Puzzlers
Python Puzzlers
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiarities
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscation
 
Python Usage (5-minute-summary)
Python Usage (5-minute-summary)Python Usage (5-minute-summary)
Python Usage (5-minute-summary)
 

Más de Wei-Yuan Chang

Data Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuanData Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuanWei-Yuan Chang
 
Data Crawler using Python (I) | WeiYuan
Data Crawler using Python (I) | WeiYuanData Crawler using Python (I) | WeiYuan
Data Crawler using Python (I) | WeiYuanWei-Yuan Chang
 
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuanLearning to Use Git | WeiYuan
Learning to Use Git | WeiYuanWei-Yuan Chang
 
Scientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuanScientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuanWei-Yuan Chang
 
Basic Web Development | WeiYuan
Basic Web Development | WeiYuanBasic Web Development | WeiYuan
Basic Web Development | WeiYuanWei-Yuan Chang
 
資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuanWei-Yuan Chang
 
JavaScript Beginner Tutorial | WeiYuan
JavaScript Beginner Tutorial | WeiYuanJavaScript Beginner Tutorial | WeiYuan
JavaScript Beginner Tutorial | WeiYuanWei-Yuan Chang
 
Introduce to PredictionIO
Introduce to PredictionIOIntroduce to PredictionIO
Introduce to PredictionIOWei-Yuan Chang
 
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Analysis and Classification of Respiratory Health Risks with Respect to Air P...Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Analysis and Classification of Respiratory Health Risks with Respect to Air P...Wei-Yuan Chang
 
Forecasting Fine Grained Air Quality Based on Big Data
Forecasting Fine Grained Air Quality Based on Big DataForecasting Fine Grained Air Quality Based on Big Data
Forecasting Fine Grained Air Quality Based on Big DataWei-Yuan Chang
 
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Coverage of Science in the Media a Big Data Study on the Impact of th...On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Coverage of Science in the Media a Big Data Study on the Impact of th...Wei-Yuan Chang
 
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
On the Ground Validation of Online Diagnosis with Twitter and Medical RecordsOn the Ground Validation of Online Diagnosis with Twitter and Medical Records
On the Ground Validation of Online Diagnosis with Twitter and Medical RecordsWei-Yuan Chang
 
Effective Event Identification in Social Media
Effective Event Identification in Social MediaEffective Event Identification in Social Media
Effective Event Identification in Social MediaWei-Yuan Chang
 
Eears (earthquake alert and report system) a real time decision support syst...
Eears (earthquake alert and report system)  a real time decision support syst...Eears (earthquake alert and report system)  a real time decision support syst...
Eears (earthquake alert and report system) a real time decision support syst...Wei-Yuan Chang
 
Fine Grained Location Extraction from Tweets with Temporal Awareness
Fine Grained Location Extraction from Tweets with Temporal AwarenessFine Grained Location Extraction from Tweets with Temporal Awareness
Fine Grained Location Extraction from Tweets with Temporal AwarenessWei-Yuan Chang
 
Practical Lessons from Predicting Clicks on Ads at Facebook
Practical Lessons from Predicting Clicks on Ads at FacebookPractical Lessons from Predicting Clicks on Ads at Facebook
Practical Lessons from Predicting Clicks on Ads at FacebookWei-Yuan Chang
 
How many folders do you really need ? Classifying email into a handful of cat...
How many folders do you really need ? Classifying email into a handful of cat...How many folders do you really need ? Classifying email into a handful of cat...
How many folders do you really need ? Classifying email into a handful of cat...Wei-Yuan Chang
 
Extending faceted search to the general web
Extending faceted search to the general webExtending faceted search to the general web
Extending faceted search to the general webWei-Yuan Chang
 
Discovering human places of interest from multimodal mobile phone data
Discovering human places of interest from multimodal mobile phone dataDiscovering human places of interest from multimodal mobile phone data
Discovering human places of interest from multimodal mobile phone dataWei-Yuan Chang
 
Online Debate Summarization using Topic Directed Sentiment Analysis
Online Debate Summarization using Topic Directed Sentiment AnalysisOnline Debate Summarization using Topic Directed Sentiment Analysis
Online Debate Summarization using Topic Directed Sentiment AnalysisWei-Yuan Chang
 

Más de Wei-Yuan Chang (20)

Data Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuanData Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuan
 
Data Crawler using Python (I) | WeiYuan
Data Crawler using Python (I) | WeiYuanData Crawler using Python (I) | WeiYuan
Data Crawler using Python (I) | WeiYuan
 
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuanLearning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
 
Scientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuanScientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuan
 
Basic Web Development | WeiYuan
Basic Web Development | WeiYuanBasic Web Development | WeiYuan
Basic Web Development | WeiYuan
 
資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan
 
JavaScript Beginner Tutorial | WeiYuan
JavaScript Beginner Tutorial | WeiYuanJavaScript Beginner Tutorial | WeiYuan
JavaScript Beginner Tutorial | WeiYuan
 
Introduce to PredictionIO
Introduce to PredictionIOIntroduce to PredictionIO
Introduce to PredictionIO
 
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Analysis and Classification of Respiratory Health Risks with Respect to Air P...Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
 
Forecasting Fine Grained Air Quality Based on Big Data
Forecasting Fine Grained Air Quality Based on Big DataForecasting Fine Grained Air Quality Based on Big Data
Forecasting Fine Grained Air Quality Based on Big Data
 
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Coverage of Science in the Media a Big Data Study on the Impact of th...On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
 
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
On the Ground Validation of Online Diagnosis with Twitter and Medical RecordsOn the Ground Validation of Online Diagnosis with Twitter and Medical Records
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
 
Effective Event Identification in Social Media
Effective Event Identification in Social MediaEffective Event Identification in Social Media
Effective Event Identification in Social Media
 
Eears (earthquake alert and report system) a real time decision support syst...
Eears (earthquake alert and report system)  a real time decision support syst...Eears (earthquake alert and report system)  a real time decision support syst...
Eears (earthquake alert and report system) a real time decision support syst...
 
Fine Grained Location Extraction from Tweets with Temporal Awareness
Fine Grained Location Extraction from Tweets with Temporal AwarenessFine Grained Location Extraction from Tweets with Temporal Awareness
Fine Grained Location Extraction from Tweets with Temporal Awareness
 
Practical Lessons from Predicting Clicks on Ads at Facebook
Practical Lessons from Predicting Clicks on Ads at FacebookPractical Lessons from Predicting Clicks on Ads at Facebook
Practical Lessons from Predicting Clicks on Ads at Facebook
 
How many folders do you really need ? Classifying email into a handful of cat...
How many folders do you really need ? Classifying email into a handful of cat...How many folders do you really need ? Classifying email into a handful of cat...
How many folders do you really need ? Classifying email into a handful of cat...
 
Extending faceted search to the general web
Extending faceted search to the general webExtending faceted search to the general web
Extending faceted search to the general web
 
Discovering human places of interest from multimodal mobile phone data
Discovering human places of interest from multimodal mobile phone dataDiscovering human places of interest from multimodal mobile phone data
Discovering human places of interest from multimodal mobile phone data
 
Online Debate Summarization using Topic Directed Sentiment Analysis
Online Debate Summarization using Topic Directed Sentiment AnalysisOnline Debate Summarization using Topic Directed Sentiment Analysis
Online Debate Summarization using Topic Directed Sentiment Analysis
 

Último

Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...HyderabadDolls
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...HyderabadDolls
 
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...HyderabadDolls
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...gajnagarg
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...nirzagarg
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowgargpaaro
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraGovindSinghDasila
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制vexqp
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...SOFTTECHHUB
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...nirzagarg
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.pptibrahimabdi22
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Klinik kandungan
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangeThinkInnovation
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabiaahmedjiabur940
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...kumargunjan9515
 

Último (20)

Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
 
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Hapur [ 7014168258 ] Call Me For Genuine Models We ...
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
 

Python Fundamentals - Basic