本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。
34 个评论
for i in range(500):
if i%5==0 and i%7==0:
print(i)
if i%5==0 and i%7==0:
print(i)
for i in range(1,1000,1):
if i%5==0 and i%7==0:
print(i)
if i%5==0 and i%7==0:
print(i)
for i in range(1,5000,1):
if (i%5==0 and i%7==0):
print(i)
if (i%5==0 and i%7==0):
print(i)
for i in range(35,5000,35):
print (i)
print (i)
用while怎么写啊。。。不好意思 有点较真。。
for i in range(1,5000):
if i%5 == 0 and i%7 ==0:
print(i)
if i%5 == 0 and i%7 ==0:
print(i)
#统计打印出1~5000中同时能被5和7整除的整数
for i in range(1,5001,1):
if (i % 35==0):
print(i)
for i in range(1,5001,1):
if (i % 35==0):
print(i)
老师有个坑,range函数并不能取到5000,如果换成能被2和5整除那就有数据差了
#0-5000内可以同时被5和7整除的数
for a in range(5001):
if a%5==0 and a%7==0:
print(a)
#0-5000内可以同时被5和7整除的数
for a in range(5001):
if a%5==0 and a%7==0:
print(a)
for i in range (1,5000,1):
if i%5 == 0 and i%7 ==0:
print (i)
i = 1
while i < 5001 :
if i%5 == 0 and i%7 ==0 :
print (i)
i += 1
if i%5 == 0 and i%7 ==0:
print (i)
i = 1
while i < 5001 :
if i%5 == 0 and i%7 ==0 :
print (i)
i += 1
for i in range(0,5001):
if(i%5 == 0 and i%7 == 0):
print(i)
if(i%5 == 0 and i%7 == 0):
print(i)
for i in range(1,500,35):
print(i-1)
print(i-1)
老师,为什么按照您写的while循环方式做的话,总是出不来结果?前边in[*]是这样显示的?是什么情况?
a = 1
while a < 5001:
if a%5 == 0 and a%7 ==0:
print(a)
a += 1
a = 1
while a < 5001:
if a%5 == 0 and a%7 ==0:
print(a)
a += 1
for i in range(1,5000):
if i % 5 ==0 and i % 7 == 0:
print(i)
if i % 5 ==0 and i % 7 == 0:
print(i)
for i in range(0,5001,5):
if i%7==0:
print(i)
if i%7==0:
print(i)
for i in range(0,5000,5):
if i != 0:
print(i)
for q in range(0,5000,7):
if q != 0:
print(q)
if i != 0:
print(i)
for q in range(0,5000,7):
if q != 0:
print(q)
count=1
while count<5001:
a=count/5
b=count/7
if type(a)==int and type(b)==int:
print(count)
count+=1
大伟老师,这样怎么运行不出来.......
while count<5001:
a=count/5
b=count/7
if type(a)==int and type(b)==int:
print(count)
count+=1
大伟老师,这样怎么运行不出来.......
那个循环里的i=i+1换成i=+1,为什么不可以?
for i in range(0,5000,35):
print(i)
print(i)
老师,我想问下循环他每一行代码顺序都是固定的吗,不能随便放的吗