mercredi 5 octobre 2022

If/Else Statements not Working in Color Choice Game

I am trying to make a color choice game where, using random.choice a color is chosen from 20, and then the program gives users a hint. I am able to click on the colors and return an input, but it is telling me I am incorrect even when clicking on the correct answer. How do I correct this bit of code so it will recognize when I am clicking the prompted color?

list1 = [barbie,rose,fuscia,punch,blush,watermelon,flamingo,rouge,salmon,coral,peach,strawberry,rosewood,lemonade,taffy,bubblegum,balletslipper,crepe,magenta,hotpink]

  choice = random.choice(list1)() 
  
  def barbiec(x,y):
    while True:
      if random.choice(list1)() != [barbie]:
        print("Try Again!")
     else:
        print("Thats Right!")




Aucun commentaire:

Enregistrer un commentaire