Reputation: 15
I am working on a soccer game and since a soccer game does for 90 minutes, I want to make it 90 seconds. How can my soccer game in my code end after 90 seconds?
Upvotes: 0
Views: 50
Reputation: 347
you can make function , and implement it in your code like this :
you can do it with more than way , here is a bunch of ways you can follow one of them :
import time
def times_up():
time.sleep(90) # wait a second
return true # when time is up will return
or you can implement the actual time to schedule after 90 seconds
import datetime
endTime = datetime.datetime.now() + datetime.timedelta(seconds=90)
while True:
if datetime.datetime.now() >= endTime:
print('time is up')
break
# Blah
# Blah
Upvotes: 1