I've been stuck on this issue for over two hours, this is homework so please don't give me a direct answer just point me in the right direction.
So... This program is designed to input a "speed limit", input "Current speed" and give you a print response of either "Speed OK" (if you are below or equal to the speed limit) and "Slow down!" (if you are speeding). When I input the following data, as required on the task: Speed Limit of 50. Current Speed of 50, 45, 55, 52, and 50.
The answer should read -
Speed limit: 50
Current speed: 50
Speed OK
Current speed: 45
Speed OK
Current speed: 55
Slow down!
Current speed: 52
Slow down!
Current speed: 50
Speed OK
Current speed:(White space)
Instead I get -
Current speed: 50
Speed OK
Current speed: 45
*Then the program stops.*
My Program Reads -
limit = int(input("Speed limit: "))
speed = int(input("Current speed: "))
if speed <= limit:
print("Speed OK")
speed = int(input("Current speed: "))
false = speed > limit
while false:
print("Slow down!")
speed = int(input("Current speed: "))
If somebody could point me in the right direction that would be wonderful ;).
Cheers,
Ron
while false:makes me cringe, even though it's technically correct. (didn't downvote, though)