jeudi 30 novembre 2017

Mastermind recreation if statements stuck

I'm recreating the Mastermind game and I'm stuck on some "if" statements i am trying make it tell the user that if the color is not the same as in guess1but is the proper color is guess2 it will print "guess 1 right color wrong position"

Python V- 2.7.8

colors =  ('R','B','G','P','Y','O')
Color1 = random.choice(colors)
Color2 = random.choice(colors)
Color3 = random.choice(colors)
Color4 = random.choice(colors)
guess1 = raw_input("First Color: ") 
guess2 = raw_input("Second Color: ")
guess3 = raw_input("Third Color: ")
guess4 = raw_input("Fourth Color: ")
guesses = (guess1,guess2,guess3,guess4)
Allcolors = (Color1,Color2,Color3,Color4)

if guesses == Allcolors:
        print "All colors are correct!"
    if guesses != Allcolors:
####
        if guess1 == Color2 or Color3 or Color4:
            print "Guess 1 right color wrong position"
        if guess1 == Color1:
            print "Color 1 is correct"
####
        if guess2 == Color2:
            print "Color 2 is correct"
        if guess3 == Color3:
            print "Color 3 is correct"
        if guess4 == Color4:
            print "Color 4 is correct"

Aucun commentaire:

Enregistrer un commentaire