課程
/后端開發
/Python
/初識Python
用python編寫程序找出100和200之間所有被5或6整除但又不能被他們倆同時整除的數,每行顯示10個數,這些數被一個空格隔開
2018-07-18
源自:初識Python 3-1
正在回答
#使用Python3.7(建議使用最新版,2版本以后就淘汰啦)
n=100
m=0
while n<=200:
? ? n=n+1
? ??
? ? if n%30==0:
? ? ? ? continue
? ? elif n%5==0 or n%6==0:
? ? ? ? print (n,end=" ")
?
? ? ? ? m=m+1
? ? if m%10==0:
? ? ? ?print ('\n')
? ? ? ? print (n)
? ? m=m+1
? ? if n%5==0 or n%6==0:
? ? ? ? print ('\n')
? ? ? ? print n,
? ? ? ? print '\n'
舉報
學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-09-20
#使用Python3.7(建議使用最新版,2版本以后就淘汰啦)
n=100
m=0
while n<=200:
? ? n=n+1
? ??
? ? if n%30==0:
? ? ? ? continue
? ? elif n%5==0 or n%6==0:
? ? ? ? print (n,end=" ")
?
? ? ? ? m=m+1
? ? if m%10==0:
? ? ? ?print ('\n')
2018-09-20
#使用Python3.7(建議使用最新版,2版本以后就淘汰啦)
n=100
m=0
while n<=200:
? ? n=n+1
? ??
? ? if n%30==0:
? ? ? ? continue
? ? elif n%5==0 or n%6==0:
? ? ? ? print (n)
?
? ? ? ? m=m+1
? ? if m%10==0:
? ? ? ?print ('\n')
2018-09-20
#使用Python3.7(建議使用最新版,2版本以后就淘汰啦)
n=100
m=0
while n<=200:
? ? n=n+1
? ? m=m+1
? ? if n%30==0:
? ? ? ? continue
? ? if n%5==0 or n%6==0:
? ? ? ? print (n)
? ? if m%10==0:
? ? ? ? print ('\n')
2018-07-18
n=100
m=0
while n<=200:
? ? n=n+1
? ? m=m+1
? ? if n%30==0:
? ? ? ? continue
? ? if n%5==0 or n%6==0:
? ? ? ? print n,
? ? if m%10==0:
? ? ? ? print '\n'