Skip to content

Add .strip() to user input handling #44

Description

@Abobakr-Mahmoud-Momtaz

Description

The user input should be stripped of leading and trailing whitespace before converting it to lowercase.

Currently:

user_input = input("Type Rock/Paper/Scissors or Q to quit: ").lower()

I suggest changing it to:

user_input = input("Type Rock/Paper/Scissors or Q to quit: ").strip().lower()

This would make the input handling more robust. For example, if the user enters rock with extra spaces, .strip() will remove them and the input will correctly become rock.

This prevents valid user input from being rejected just because of accidental leading or trailing spaces.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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