Python Forum
RockPaperScissor program while loop malfunction
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RockPaperScissor program while loop malfunction
#4
I did not encounter problems but from the looks of your code I can say a few things. First, inside the while loop you need to redefine the again variable, otherwise it will use the same response. Also, you can use the lower function to compare. Instead of having a list of lower and uppercase letters. Just do this again.lower() == "y" there's also an upper function. Also, I'd like to point out that you can instead of doing gamePlayed = gamePlayed + 1 you can use gamePlayed += 1 which adds one to the original value, this also works with subtraction, division, etc.
Reply


Messages In This Thread
RE: RockPaperScissor program while loop malfunction - by SheeppOSU - Apr-03-2020, 11:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using If Statements Instead of While Loop in Simple Game Program new_coder_231013 5 3,260 Dec-14-2021, 12:23 AM
Last Post: supuflounder
  How to compile following python loop program reinispl 3 2,004 Oct-27-2021, 01:57 PM
Last Post: DeaD_EyE
  Program that, inside a loop, does multiple things. needs to print in a certain way reidmcleod 1 2,710 Feb-19-2019, 02:35 PM
Last Post: marienbad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020