我根据爱因斯坦台阶问题编的python到底出了什么问题??
本帖最后由 B-C 于 2020-8-27 16:14 编辑跑是跑得起来,但是过了好久都没有反应
因为这个的原因,我还特地在中间设置了踩点程序
可是跑起来的时候连踩点程序都没出来···
这个怎么办呀
上代码:
i = 1
maxx = 10
minn = 0
while minn <i <= maxx:
if i == maxx:
print('在阶数为',7 * (maxx - 1),'内找不到答案')
maxx == maxx + 10
minn == minn + 10
if 7 * i % 2 == 1 and 7 * i % 3 == 2 and 7 * i % 5 == 4 and 7 * i % 6 == 5:
break
else:
i == i + 1
print('答案为',7 * i) ==改为=
本帖最后由 sunrise085 于 2020-8-27 16:22 编辑
第8 、9 、14行错了,赋值等号=写成了相对比较符==
i = 1
maxx = 10
minn = 0
while minn <i <= maxx:
if i == maxx:
print('在阶数为',7 * (maxx - 1),'内找不到答案')
maxx = maxx + 10
minn = minn + 10
if 7 * i % 2 == 1 and 7 * i % 3 == 2 and 7 * i % 5 == 4 and 7 * i % 6 == 5:
break
else:
i = i + 1
print('答案为',7 * i)
chongchuigu 发表于 2020-8-27 16:17
==改为=
具体是哪里的 == 呢 i = 1
maxx = 10
minn = 0
while minn <i <= maxx:
if i == maxx:
print('在阶数为',7 * (maxx - 1),'内找不到答案')
maxx = maxx + 10
minn = minn + 10
if 7 * i % 2 == 1 and 7 * i % 3 == 2 and 7 * i % 5 == 4 and 7 * i % 6 == 5:
break
else:
i = i + 1
print('答案为',7 * i)
页:
[1]