Continuous Loop is Not Working - Python -
i beginner @ python have used other languages , wrote simple program should continuous loop.
the program should display , count 360 , start @ 0. appreciate feed or advice. here code.
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"
as mikhus said, make infinite loop, have change last line:
turn = "yes" to:
turn = "yes" since if compared turn "yes" in loop, it's going return false if you've set "yes", they're not same.
this better overall:
import time currentrotation = 0.00 while true: while currentrotation < 360: time.sleep(0.005) currentrotation += 0.01 print("current rotation =", currentrotation) else: currentrotation = 0.00
Comments
Post a Comment