how to check when a key is pressed and released in python code example
Example: how to check if a key is pressed in python
IN Terminal: pip install keyboard
inside code-
import keyboard
# if key 'a' is pressed
if keyboard.is_pressed('a'):
print('a key has ben pressed')