This is my first post, and I will try to be as detailed as possible.
I am recreating the game "Mastermind", but instead of colors, letters are used. The color "red" would be "R", "yellow" would be "Y", etc...
I must check for errors, and when an error is inputted by the user, the output should be guess = input("Error, try again: ")
.
ANY ERRORS can NOT be counted as an attempt. There are a total of 8 attempts. I must check for other things as well, but I have already completed that part.
Here is the code I am having trouble with:
if len(guess) == 4 and (guess.upper().count("R") + guess.upper().count("Y") + guess.upper().count("B") +\
guess.upper().count("G") + guess.upper().count("W") + guess.upper().count("O") == 4):
For the colors RGYBWO
, if the user inputs for example: RYGW
, can I sum up that up to be == 4?
In simpler terms, can I check that each letter is there and add them up to = 4 ?
If not, I will post the full code.