Skip to content

Update rock_paper_scissors.py#8

Open
brauliobolano wants to merge 1 commit into
kying18:masterfrom
brauliobolano:patch-1
Open

Update rock_paper_scissors.py#8
brauliobolano wants to merge 1 commit into
kying18:masterfrom
brauliobolano:patch-1

Conversation

@brauliobolano
Copy link
Copy Markdown

Hi. I loved your video. I just want to contribute. I'm a freeCodeCamp student. created a dictionary choices just to map the user input ('r', 'p', 's' ) to the full word ( 'rock', 'paper', 'scissors') for better readability.

Also. I used the lower( ) method to convert it to lowercase. so, this way, the user can input either uppercase or lowercase characters without causing any issues.

And I simplified the condition for checking the winner by directly comparing the choices instead of using a separate function is_win. I think looks nice.

Hi. I loved your video. I just want to contribute. I'm a freeCodeCamp student.  created a dictionary choices just to map the  user input ('r', 'p', 's' ) to the  full word ( 'rock', 'paper', 'scissors') for better readability.

Also. I used the lower( ) method to convert it to lowercase. so, this way, the user can input either uppercase or lowercase characters without causing any issues.

And I simplified the condition for checking the winner by directly comparing the choices instead of using a separate function is_win. I think looks nice.
@brauliobolano
Copy link
Copy Markdown
Author

Changes made :)

Created a dictionary choices to map user input ('r', 'p', 's') to the corresponding full word ('rock', 'paper', 'scissors') for better readability in the result messages.
Used the lower() method on the user input to convert it to lowercase. This way, the user can input either uppercase or lowercase characters without causing any issues.
Simplified the condition for checking the winner by directly comparing the choices instead of using a separate function is_win.
With these changes, the code should still function the same way as before but is now a bit more concise and easier to read.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant