![TQC+ 程式語言Python 201 偶數判斷 TQC+ 程式語言Python 201 偶數判斷](https://i0.wp.com/jbprogramnotes.com/wp-content/uploads/2020/05/TQC-252B-2BPython.png?resize=1024%2C576&ssl=1)
TQC+ 程式語言Python 201 偶數判斷
題目說明:
請使用選擇敘述撰寫一程式,讓使用者輸入一個正整數,然後判斷它是否為偶數(even)。
範例輸入1
56
範例輸出1
56 is an even number.
範例輸入2
21
範例輸出2
21 is not an even number.
程式碼:
n = eval(input())
if n % 2 == 0:
print('%d is an even number.' %n)
else:
print('%d is not an even number.' %n)
TQC+ 程式語言Python 第2類:選擇敘述
![](https://i0.wp.com/images.contentstack.io/v3/assets/bltf59a0f025a7625f9/blt822683c9ebfb0e0e/6445f4afd0a4771107c6ba02/9779_XS%E9%BA%9D%E9%A6%99%E8%91%A1%E8%90%84%E8%83%BD%E9%87%8F%E9%A3%B2_Mini_Poster_updated.jpg?w=640&ssl=1)
如果覺得文章內容還不錯的話,麻煩請幫我點個讚!感謝
可以多點幾次喔~~
第一次點讚需使用 Google 或 Facebook 帳號註冊
![TQC+ 程式語言Python 202 倍數判斷 TQC+ 程式語言Python 202 倍數判斷](https://i0.wp.com/jbprogramnotes.com/wp-content/uploads/2020/05/TQC-252B-2BPython.png?resize=75%2C75&ssl=1)
![TQC+ 程式語言Python 110 正n邊形面積計算 TQC+ 程式語言Python 110 正n邊形面積計算](https://i0.wp.com/jbprogramnotes.com/wp-content/uploads/2020/05/TQC-252B-2BPython.png?resize=75%2C75&ssl=1)
一個評論
自動引用通知: