[Solved] Break out of Python for loop
You could just iterate until 5 instead of 6 and print your message out of the loop: for counter in range(5): # Remove the if statement: # if counter == 5: # print(“”) # break myCar.accelerate() time.sleep(1) print(“Maximum speed reached!”) 1 solved Break out of Python for loop