趣学python3(8)-循环语句(2)
生活随笔
收集整理的這篇文章主要介紹了
趣学python3(8)-循环语句(2)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
num1=-1
while num1<1 or num1>500:print("請輸入一個整數(1-500):") num1=int(input())
dividend=[3,5,7,9,11,13,15]
for num2 in dividend:if num1%num2==0:print(f"{num1}被{num2}整除")else:print(f"{num1}不能被{num2}整除")
請輸入一個整數(1-500):
2900
請輸入一個整數(1-500):
-13
請輸入一個整數(1-500):
19
19不能被3整除
19不能被5整除
19不能被7整除
19不能被9整除
19不能被11整除
19不能被13整除
19不能被15整除
總結
以上是生活随笔為你收集整理的趣学python3(8)-循环语句(2)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 趣学python3(7)-循环语句(1)
- 下一篇: 趣学python3(9)-range