A simple Python-based typing speed and accuracy test that fetches random sentences directly from Wikipedia using their public API. The player types the displayed sentence as quickly and accurately as possible, and the program calculates their Words Per Minute (WPM) and accuracy.
- Fetches a random sentence from Wikipedia via the API.
- Measures typing speed (WPM) based on elapsed time.
- Evaluates accuracy by comparing typed words to the original sentence.
- Allows the user to play multiple rounds in one session.
- Lightweight and runs entirely in the terminal.
- A random Wikipedia article is fetched.
- The first sentence of the article is displayed.
- The user presses
Enterto start, types the sentence, and pressesEnteragain when done. - The program calculates:
- Words Per Minute (WPM) = number of words typed ÷ time taken × 60
- Accuracy (%) = number of correctly typed words ÷ total words × 100
- The results are printed to the console.
- The user can press
nto fetch a new sentence or any other key to quit.
- Python 3.7 or higher
requestslibrary
Install dependencies with:
pip install requests- Clone or download this repository.
- Open a terminal in the project directory.
- Run the program:
python main.py
- Follow the on-screen instructions.
Press Enter when you're ready to type the sentence:
Python is a widely used high-level programming language.
Python is a widely used high-level programming language.
Results:
Words Per Minute (WPM): 42.31
Accuracy (% of words typed correctly): 100.00%
Type 'n' for a new sentence or any other key to exit:
| File | Description |
|---|---|
main.py |
Main program containing all logic (fetching, timing, and results) |
README.md |
Project documentation |
- Add difficulty levels (short vs. long sentences).
- Include punctuation accuracy checking.
- Display leaderboard for multiple players.
- Create a GUI version with Tkinter or Streamlit.