I want to create a game where the idea is to spam as much as possible in the time limit:9.58 (it's linked to running). Here is what I've got. My problem is I'm not sure how to create a clock whilst counting the number of something/receiving input
import time
print("Spamming race")
print("*************")
print("Running and spamming have alot in common, like in in running")
print(" you want to see how quick you cross the line and in ")
print("spamming the aim is to shut down the server as quick as")
print("possible.")
max_time =1
t=31
start_time = time.time()
g=input()
distance=g.count('1')
if time.time-start_time>max_time>t:
print("And he crosses the line with a distance of ",distance)
I have tried to approach this in different matters but it there may be a line of code I don't know which may help.