I'm making a Python Among Us game (kinda). I need some help on making a time limit on how quick the person has to input the text. Look at my code below.
import random
print("Python Among Us")
print()
role = ["Crewmate", "Crewmate" , "Crewmate", "Crewmate", "Crewmate", "Crewmate", "Crewmate", "Crewmate", "Crewmate", "Impostor"]
roleconfirmed = random.choice(role)
print("You are a", roleconfirmed, "!")
if roleconfirmed == ("Crewmate"):
firstdestination = input("Where would you like to go? ")
print("You are currently in", firstdestination)
if firstdestination == ("Admin"):
print("You have no tasks in this section.")
elif firstdestination == ("Cafeteria"):
print("You have one task, that task is Empty Garbage.")
wouldliketodotask = input("Would you like to do your tasks? ")
if wouldliketodotask == ("Yes"):
whichtasktodo = input("Which task would you like to do? ")
if whichtasktodo == ("Empty Garbage"):
emptygarbagetask = input("You have 5 seconds to type Swipe Down: ")
if emptygarbagetask :
print("You failed to do the task!")
else:
print("You completed the task!")
At the bottom, I left the if emptygarbagetask :
open, for the community to help me solve. Before you say "oh look at the other questions" my answer is, yes I have looked, but I am having trouble trying to put it in there.