我试图用python 2.7解决这个问题。我刚刚开始编程,所以我希望你们中的一个能帮助我的人!
这就是我现在所拥有的:
my_list = [2,3,4,5,6,7,8,9,10,11,]
for a in range(0, 39916800):
if (a % my_list == 0):
print("a")
答案=
a = 2*3*4*5*6*7*8*9*10*11
a = a-1
for a in range (0,a):
if a % 2 == 0:
if a % 3 ==0:
if a % 4 ==0:
if a % 5 ==0:
if a % 6 ==0:
if a % 7 ==0:
if a % 8 ==0:
if a % 9 ==0:
if a % 10 ==0:
if a % 11 ==0:
print a
if a > 1:
break
答案 0 :(得分:0)
首先,我认为你的逻辑有点偏。我会循环遍历清单。
此代码并不能完全解答您的问题,但它似乎是一个很好的踩踏石头
my_list = [2,3,4,5,6]
for a in my_list:
for sub in range(len(my_list)): # nesting loop. pretty much for each num, it goes over each num in mylist again
if a % my_list[sub] == 0:
pass # nothing is required at this step, pass just allows the if to print or no nothing if the conditional is true
if a == len(my_list):
print(a)