lundi 22 novembre 2021

How is it possible that my if statement does not do what i want?

rock = ''' _______ ---' ) () () () ---.(_) '''

paper = ''' _______ ---' ) ______) ____) ) ---.) '''

scissors = ''' _______ ---' ) ______) _) () ---.() '''

#Write your code below this line 👇 import random choices = [rock, paper, scissors] user_choice = input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n") if user_choice == "0": print(rock) elif user_choice == "1": print(paper) else: print(scissors)

computer_choice = random.randint(0, 2) print(computer_choice) print(choices[computer_choice])

if(user_choice == "0" and computer_choice == "2"): print("You win.")

I initially thought that I messed up with having multiple if statements, but that cannot be the problem because I deleted all of them and left only one if statement. I waited for the if statement to come true by clicking Run over and over again till the condition came true but nothing happened. It should have said that I won. This is a practice exercise for a Udemy course but I am desperate here. I tried everything but it does not work.

Aucun commentaire:

Enregistrer un commentaire