while 1:
time.sleep(1)
for i in range(0,1000,60):
if sayi % i == 0:
print "Şu an"+ sayi/60+". dakikaya girdik."
print "Şu an %s'nci saniyedeyiz." % str(sayi)
sayi = sayi +1
我明白了:
SyntaxError: can't assign to operator
即使我改变了它仍然会给出错误
Traceback (most recent call last):
File "<pyshell#33>", line 4, in <module>
if sayi % i == 0:
ZeroDivisionError: integer division or modulo by zero
答案 0 :(得分:1)
您应该从1
开始for循环,而不是0
。除以0在数学和程序上是非法的。
将for循环的行更改为:
for i in range(1,1000,60):
在此更改后,您的代码不应该崩溃(至少出于这个原因)。