QUESTION IMAGE
Question
you wrote a program where you played rock, paper, scissors against the computer. you allowed the user to enter either upper - or lowercase answers. complete the code so that the comparison to rock will work. play = input(\enter rock, paper, or scissors, or a q to quit. \) play = play. () if play == \q\: keepgoing = false elif play == compplay: print(\you both chose the same. no winner. \)
Step1: Analyze the requirement
The code needs to handle both upper - and lowercase inputs. The lower() method in Python converts a string to lowercase.
Step2: Apply the method
Since the comparison in the if statements (e.g., play == "q" and play == compPlay) is done with lowercase strings, we should convert the user input (stored in play) to lowercase. So the missing part is lower.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
lower