` # 1 (code introduction) import random
print("Welcome to Response Time Tester!")
print("You will be asked to press Enter after random amounts of time.")
print("How close can you get? ")
print()
while True:
try:
rounds = int(input("Enter desired number of rounds: "))
if rounds <= 0:
print("Number of rounds must be greater than zero. Try again.")
else:
break
except ValueError:
print("Invalid input. Enter a number.")
num = random.randint(2, 8)
for i in range(rounds):
print("round 1 of",i+1)
print(f'Press Enter in', num, 'seconds')
#Difference Rating
#<= 0.25 Excellent!
#<= 0.5 Great!
#<= 1 Good!
#<= 2 OK!
#> 2 Miss
so in my code i want to ask the user to press Enter in a certain amount of seconds and that data gets recorded and put in a variable or something for the result. I will then compile all the results and tell the user how quick he was based on this scale.