Skip to content

Week_1 Project Review #1

@Ds2023

Description

@Ds2023

What was done well

  • Clear initialization:
    You've correctly set up and initialized variables for scores and rounds at the start of the program.

  • Correct loop usage:
    The while loop accurately runs for a fixed number of rounds, ensuring the game has a clear duration.

  • Random choice:
    The use of random.choice() is a great way to have the computer pick an option, making the game unpredictable.

  • Logical win conditions:
    The if/elif/else structure correctly checks all the winning, losing, and tie scenarios based on the game's rules.

  • Final outcome:
    The code correctly determines the overall winner at the end of the game by comparing the final scores.


What could be improved

  • Input validation and sanitization:
    The code doesn't check if the user's input is a valid choice (e.g., "rock", "paper", "scissors").
    It is also case-sensitive, so typing "Rock" would result in a loss.
    Using .lower() on the input would fix this.

  • Concise conditional logic:
    The if/elif statements for checking wins and ties are a bit long.
    You could make this more efficient by using a dictionary to store winning combinations, similar to the suggestion in the previous feedback.

  • Redundant code:
    The line

    user_guess = str(user_guess)

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