Apr-08-2018, 01:38 PM
Hello, I am making a Python game where there is a sequence of letters, and you have to guess it right within a certain amount of time. However, once the player pushes enter, the code is reviewed. Unless, of course, the time runs out, in which case it just passes. Here is my current code:
Thank You.
now = time.time() limit = now + 15 while time.time() < limit: r2 = raw_input("Commands:") pass word2 = 'sddddwwdddx' for i in range(min(len(r2), len(word2))): if r2[i] != word2[i]: errors += 1 if errorlevel >= errors or errors == 0: print"Your plane sucsessfully went through the course!" else: passHowever, the person could not press enter until the time is up, but since they don't know when time is up, they have to wait much longer. How could I make it so when you press enter, it exits out of the while loop, but also immediately ends the person's choice if the time is up?
Thank You.