Let’s make a simple keyboard racing game using Python. In the game, the participant clicks a pair of keys in quick succession and the program shows the total time taken by the racer to cover the distance.
As soon as you see ‘GO!’ on screen, start pressing the keys ‘z’ and ‘x’. A ‘*’ sign is shown for every metre covered. Pressing ‘z’ and ‘x’ once will be counted as 1 metre; targets is to cover 10 metres.
msvcrt : Used to get keystroke as input for race time : Used to calculate time taken to complete the race
Note that MSVCRT module can only function on a terminal window, not on a GUI program/IDE.
Below is the code:
- Keyboard module in Python
- Mouse and keyboard automation using Python
- Python | Vkeyboard (virtual keyboard) in kivy
- Simple Chat Room using Python
- Python | Simple calculator using Tkinter
- Python | Simple GUI calculator using Tkinter
- Python | Creating a Simple Drawing App in kivy
- Simple Multithreaded Download Manager in Python
- Python | Make a simple window using kivy
- Python | Simple registration form using Tkinter
- Python | Simple FLAMES game using Tkinter
- Python | Program to implement simple FLAMES game
- Python | Create a simple assistant using Wolfram Alpha API.
- Python | Create simple animation for console-based application
- Python | Thresholding techniques using OpenCV | Set-1 (Simple Thresholding)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.