I am making a game and I don't get why when I input the right values, it won't print the winning text
For example, for testing I would input the correct random color, but nothing will display after I input the right answer.
Everything else prints out fine.
import random
print()
print(" M A S T E R M I N D ")
print(" --------------- ")
print()
print("The rules to this Master Mind game is simple. You have to guess the 4 COLORS that I am thinking correctly.")
print()
print(" R U L E S ! ")
print(" ------ ")
print()
print(" 1. YOU only need to guess 4 colors. ")
print()
print(" 2. Please key in the correct keyword for each color. ( Without spaces )")
print(" E.g rbgy ")
print()
print(" 3. List of colors: Red (r), Blue (b), Green (g), Yellow (y). ")
print()
print()
colorCode = ['r','b','g','y']
random.shuffle(colorCode)
print(colorCode)
print()
print()
playerGuess = str(input("Guess the color: "))
playerGuess = playerGuess.lower()
print ()
if (playerGuess == colorCode):
print(" You truly are a M A S T E R M I N D . ")
else:
counter = 0
while (playerGuess != colorCode):
counter += 1
count = 0
correct = ['X']*4
for p in range(0,4):
if(playerGuess[p] == colorCode[p]):
count += 1
correct[p] = playerGuess[p]
else:
continue
if (count < 4) and (count != 0):
print("Close! But you did get", count, "correct!")
print("These are the correct guesses. Keep going!")
print()
for k in correct:
print(k, end='')
print()
print()
playerGuess = input("Guess the color: ")
playerGuess = playerGuess.lower()
elif (count == 0):
print("None of your guess are close!")
playerGuess = input("Guess the color: ")
playerGuess = playerGuess.lower()
if playerGuess == colorCode:
print("You win!")
print("It took you", counter, "tries")