I am trying to make a simple python game to train my skills,it's something like a dungeon with traps and things like that here's a part of the game code:
from sys import exit
def trap():
print "You've fallen into a trap,you have 10 seconds to type the word \"Get me out\""
user_input = raw_input("> ")
right_choice = "Get me out"
if *SOME CODE*:
*MORE CODE*
else:
die("you died,you were too slow")
def die(why):
print why , "Try again"
exit(0)
as u can see i want to end the python script after 10 seconds if the user_input wasn't equal to right_choice by replacing SOME CODE,MORE CODE in the code example above,how to do that?