I'm trying to detect a key press to determine whether the user wants to play again, but msvcrt.getch() is just not working for me. This is my code:
import msvcrt
#the game here
    print "Do you want to continue? Y/N"
    if msvcrt.getch() == 'Y' or msvcrt.getch() == 'y':
        print"Let's play again!"
        print"-----------------"
    elif msvcrt.getch() == 'N' or msvcrt.getch() == 'n' :
        "Okay, hope you had fun"
        break
Any suggestions?
EDIT: The answers below do work on the command line, for some reason just don't in PyCharm
                        
You should only call
msvcrt.getch()once. Change your code to something like this: