# Python班 ## 2/16 社課 --- ## 靜態展 ---- 靜態展就類似於成果展覽 在校慶之際,動態性社團如舞蹈、熱音、魔術、低閉等,參加的叫做***校慶晚會***,而電算、網管、烹飪等較靜的社團會在校慶當日設有***靜態展***。 ---- 電算社的靜態展,照以往經驗有兩種方式 1. 做一個大的成品拿來展示 2. 放很多人的小程式,供大家欣賞 3. ~~上台唱只有我的旁邊 旁邊沒有人~~ ---- 例如我們去年做的: ![image](https://hackmd.io/_uploads/H1FpSUjjp.png =x400) ---- ### 而今年,輪到你們了! ---- 因此,強烈要求大家現在填一下跟點名表單一起附上的[靜態展幹部報名連結](https://docs.google.com/forms/d/e/1FAIpQLSeKHBHRgDu5VHfLY_Y01tWYNpHQQl-lYs-yLP0zU9jKDYeKRw/viewform?usp=sharing)。 ---- 也因此,我們打算一段以前都來教 ![image](https://hackmd.io/_uploads/SJXbFIisp.png =x200) --- # 不過 ---- 在 ---- 那 ---- 之 ---- 前 ---- 我 ---- 們 ---- 得 ---- 先 ---- 來 ---- 複 ---- 習 ---- 上 ---- 學 ---- 期 ---- 的 ---- 語 ---- 法 --- ### 語法總複習 --- #### 變數定義、輸入輸出 ```python= a = 1 b = "1" c = input() d = int(input()) print(a,b,c,d,sep = "crc", end = "HSNU") ``` 結果 ```python= 1crc1crc2crc3HSNU ``` ---- #### 加入map 輸入多項變數 ```python= d, e, f = map(int, input().split()) print(d, e, f) ``` 也可以 ```python= g = list(map(str, input().split)) ``` ---- #### 判斷式、條件判斷 ```python= a, b = map(int, input().split()) if (a % 3 == 0): print(a / 3 - b) elif (a % 3 == 1): b = a print(b) else: print(a + b) ``` ---- #### for迴圈 兩種形式 ```python= for i in range(0, 4, 2): ; for j in [1, 2, 3]: ``` 示範 ```python= for i in [3, 8, 11, 16, 28, 43]: if i % 2 == 1: continue; else: print(i) ``` ---- #### while迴圈 ```python= ans = 69 times = 0 while times < 10: a = int(input()) if a == ans: print("Not bad") break else: print("Failure") times += 1 ``` ---- #### 函式 ```python= def s(x): return int(x)*int(x) a, b, c = map(s, input().split()) print(a, b, c) ``` ---- #### 最後 常見錯誤 ```pyhton= a = input() b = 8 if a = b: print(You got it right.) ``` --- ## 謝謝大家
{"title":"112-2-Python班-靜態展&語法複習","contributors":"[{\"id\":\"084e105f-92be-4605-b399-8d3c0ef40c64\",\"add\":1995,\"del\":136}]"}
    86 views