Skip to content

Python project Review: Number Guessing Game #1

Description

@bonareri

Requirements Checklist

Requirement Comments
Generate a random number between 1–100 Correctly implemented using the random module.
Allow the user to guess the number Successfully implemented.
Provide "Too High" and "Too Low" feedback Correct feedback is provided after each guess.
Difficulty levels (Easy, Medium, Hard) All three difficulty levels are included.
Different number of attempts per difficulty Easy (10), Medium (7), and Hard (5) are correctly assigned.
Display remaining guesses Remaining attempts are displayed after each incorrect guess.
End game on correct guess The level ends immediately when the correct number is guessed.
End game when attempts run out The game ends when the player exhausts all attempts.
Save scores to a text file Not implemented.
Hint after three incorrect guesses (Optional) Not implemented.
Leaderboard (Optional) Not implemented.

Strengths

  • Good use of a dictionary to store difficulty levels and the number of attempts, making the program flexible and easy to update.
  • The program uses a list and index to automatically progress through all difficulty levels, which is a creative approach.
  • Clear and logical program flow with well-organized loops.
  • Appropriate use of conditional statements to provide feedback for guesses.
  • Remaining attempts are displayed after every incorrect guess.
  • Meaningful variable names improve readability.
  • Comments are included throughout the program to explain the purpose of different sections.

Areas for Improvement

1. Project Requirements Misinterpreted

The project instructions required the user to choose one difficulty level before starting the game.

In this implementation, the player is automatically taken through Easy, Medium and Hard levels in sequence after winning each level.

Recommendation: Allow the player to select a single difficulty level at the beginning instead of progressing automatically.

2. No Score Saving

The project requires saving the player's username and score to a text file.

This functionality has not been implemented.

Recommendation: Prompt the user for a username and save their score after each game.

3. No Username

The program never asks for the player's username.

This makes it impossible to associate scores with individual players.

4. No Input Validation

The program assumes the user always enters a valid integer.

If text or invalid input is entered, the program will terminate with an error.

Recommendation: Validate user input before processing guesses.

5. Guess Range Is Not Checked

Although the game is based on numbers between 1 and 100, guesses outside this range are accepted.

Recommendation: Ensure guesses are validated before being compared with the secret number.

6. No Replay Option

The program ends once the player loses or completes all three levels.

Recommendation: Allow the player to decide whether they would like to play again.

7. Optional Features Missing

The optional project enhancements were not implemented.

Examples include:

  • Hint after three incorrect guesses.
  • Leaderboard showing previous high scores.

Code Quality

Strengths

  • Excellent use of dictionaries.
  • Good use of loops to manage gameplay.
  • Well-commented code.
  • Readable variable names.
  • Logical and easy-to-follow structure.

Improvements

  • Follow the project requirements more closely by allowing the user to select a difficulty level.
  • Implement score saving.
  • Add username input.
  • Validate user input.
  • Validate the guess range.
  • Implement optional enhancements.

Mark Breakdown (125 Marks)

Category Marks
Core Requirements 46 / 50
Program Logic 23 / 25
Functions 5 / 10
File Handling 0 / 10
Input Validation & Error Handling 6 / 10
Code Organization 10 / 10
Optional Features 0 / 10
Code Readability & Documentation 10 / 10
Adjusted Total 100 / 125

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions