Python 入門指南 5.0
exercise1903.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 | # 引入 exercise1902
import exercise1902
# 重新設定全域變數
count = exercise1902.count
# 遞增計數的全域變數
def add_count2():
global count
count += 10
# 印出全域變數
def print_count2():
print(count)
# 執行部分
if __name__ == "__main__":
print_count2()
exercise1902.add_count()
add_count2()
print_count2()
exercise1902.print_count()
# 檔名: exercise1903.py
# 說明:《Python入門指南》的練習
# 網站: http://kaiching.org
# 作者: 張凱慶
# 時間: 2023 年 10 月
|