下面是我在Python挑战中使用的一段代码。你知道吗
for letter in range(10,switches - 10):
if switchpoints[letter] == switchpoints[letter - 1] + 3 and switchpoints[letter] == switchpoints[letter + 1] - 1 and switchpoints[letter] == switchpoints[letter + 2] - 4 and switchpoints[letter] % 2 == 1:
print(str(letter) + "-" + str(switchpoints[letter])
for the_point in range( -3 , 4 ):
print(str(switchpoints[letter + the_point]))
第一个for循环工作正常,if语句也是如此,但是第二个for循环给了我一个错误。当我在网站http://interactivepython.org/runestone/static/thinkcspy/index.html上测试它时,它告诉我有一个解析错误,但对我没有帮助。为什么这会给我一个错误?你知道吗
缺少
)
:你可能还需要考虑一下你的逻辑。你确定你的支票对吗?你知道吗
相关问题 更多 >
编程相关推荐