我是python的初学者,但是我已经使用了其他语言,并且我编写了这个应该是连续循环的简单程序。连续循环不工作 - Python
该程序应显示并计数到360,然后从0开始。我会感谢任何反馈或建议。这是我的代码。
import time
currentRotation = 0.00
turn = "Yes"
start = 1
while start == 1:
while turn == "Yes":
while currentRotation < 360:
time.sleep(0.005)
currentRotation = currentRotation + 0.01
print("Current Rotation =", currentRotation)
else:
currentRotation = 0.00
turn = "No"
else:
turn = "yes"
你必须改变反过来=“是”转=“是”,使其工作:) – Mikhus
@Mikhus - 我刚来到这个结论之前,我看到您的评论。这就是答案。发表它。 – mgilson
+1 for @Mikhus,另外,你可以通过使用1和0来代替字符串来避免这些问题并保存了一个你永远不会真正使用的var声明 – Andenthal