Re: Rock Paper Scissors Code Bug?
Mats Wichmann <[email protected]> Thu, 18 Dec 2025 09:37:46 -0700
| Newsgroups | gmane.comp.python.general |
|---|---|
| Message-ID | <[email protected]> |
On 12/18/25 06:13, Thomas Passin wrote: > On 12/17/2025 10:43 PM, Gregg Drennan via Python-list wrote: >> The other recommendation i would make is to shorten the response the >> player >> needs to give when choosing their option. "R", "P", "S" is sufficient to >> determine the player's choice. Making the player enter the whole word >> introduces opportunity for misspellings. I would also allow the >> player to >> enter "Q" in case they decide to stop playing. And always check to make >> sure the player entered something and didn't just hit enter. Also don't >> use .lower() until you check to make sure you have a valid entry, the >> player might enter a character that can't be converted to lower case, >> like >> a number or punctuation. > > See, here's the problem with relying on a chatbot. Calling lower() works > fine for a character that doesn't have a lowerclass version. It just > returns the original. casefold() is more reliable for comparisons for non-ASCII characters. Since the set of acceptable strings appears to be bounded, that's perhaps an unnecessary detail here. -- https://mail.python.org/mailman3//lists/python-list.python.org