+ 1
How to print a certain text in the screen after a particular time using python?
Suppose you're making a car game (without GUI) You type 'strt' to start and 'stp' to stop When you type 'strt', the car runs. Initially it's speed is 30 km/hr. In the screen, it shows "SPEED : 30 KM / HR" After 3 seconds, a new text gets printed on the screen, which says, "SPEED : 50 KM / HR" Also, i want this speed to keep changing time by time How to create such a code?
2 odpowiedzi
+ 2
import time
speed=0
print(speed)
while True:
speed+=1
print(speed)
time.sleep(1) #in seconds
The above Program increase speed by 1 in every seconds.
0
Vadivelan thank you ❤️