python课后作业爱因斯坦的数学谜题。不是很理解代码
steps = 7i = 1
FIND = False
while i < 100:
if (steps % 2 == 1) and (steps % 3 == 2) and (steps % 5 == 4) and (steps % 6 == 5):
FIND = True
break
else:
steps = 7 * (i + 1)
i = i + 1
if FIND == True:
print('阶梯数是:', steps)
else:
print('在程序限定的范围内找不到答案!')
find=false是什么意思
while i < 100:
if (steps % 2 == 1) and (steps % 3 == 2) and (steps % 5 == 4) and (steps % 6 == 5):
FIND = True这一段是什么意思 本帖最后由 学习型motor 于 2020-9-21 19:20 编辑
设置一个类似标记的东西,当7的倍数(小于100)同时满足(除以2余1、除以3余2、除以5余4、除以6余5)这四个条件时,将他打印出来,如果不满足则打印找不到
FIND = True 就是用来设置这个标记的值,用在下面判断是否满足条件的,满足则跳出循环
页:
[1]