#Python TQC考題202_倍數判斷
x=eval(input())
if x%3==0 and x%5==0:
print(“{} is a multiple of 3 and 5.”.format(x))
#沒有要設定格式, { }中的:可加可不加
#加了:也可正常執行
elif x%3==0 and x%5!=0:
print(“{} is a multiple of 3.”.format(x))
elif x%3!=0 and x%5==0:
print(“{} is a multiple of 5.”.format(x))
else:
print(“{} is not a multiple of 3 and 5.”.format(x))

# { }中有加:仍可正常執行:


# n%3 == 0,後面再加 and n%5 != 0
#看似比較嚴謹,但沒加沒出錯





![Python TQC考題610 平均溫度,不要自找麻煩用2D list做,可練習2D轉1D: 一維串列.extend(二維串列[index]) Python TQC考題610 平均溫度,不要自找麻煩用2D list做,可練習2D轉1D: 一維串列.extend(二維串列[index])](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2022/05/20220515192908_35.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python 進階技巧:海象運算子 (Walrus Operator) 實戰教學 [w_clean for w in words if (w_clean:=w.lower().strip()) and w_clean not in STOPWORDS] Python 進階技巧:海象運算子 (Walrus Operator) 實戰教學 [w_clean for w in words if (w_clean:=w.lower().strip()) and w_clean not in STOPWORDS]](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2026/02/20260210083748_0_a7d9bf.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



近期留言