Python 入門指南 V2.00 - 單元 5 範例及練習程式碼



exercise0501.py


1
2
3
4
5
6
7
8
9
10
11
a = 2
b = 8
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a % b)
  
# 檔名: exercise0501.py
# 作者: Kaiching Chang
# 時間: July, 2014

exercise0502.py


1
2
3
4
5
6
7
8
9
10
11
a = int(input("Please input the first number: "))
b = int(input("Please input the second number: "))
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a % b)
  
# 檔名: exercise0502.py
# 作者: Kaiching Chang
# 時間: July, 2014

exercise0502.py


1
2
3
4
5
6
7
8
9
10
a = "*"
print(a)
print(a + a)
print(a + a + a)
print(a + a + a + a)
print(a + a + a + a + a)
  
# 檔名: exercise0502.py
# 作者: Kaiching Chang
# 時間: July, 2014

the end

沒有留言: