I am trying to control a robot with the keyboard. I want to get the user input from the keyboard and call the respective function, it could be the letters "l" for left, "r" for right and "e" for exit.
direction = ""
while direction != "e":
    direction = input("enter direction: ")
    if direction == "r":
        goRight()
    elif direction == "l":
        goLeft()
The code is working but the user have to type the enter key each time. Is there a solution to read the key immediately when typed?
 
    