I am creating a rock, paper and scissors game.
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
#Write your code below this
import random
list = [rock, paper, scissors]
choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n"))
my_choice = list[choice]
print (my_choice)
computer_choice = list[random.randint(0,2)]
print("Computer chose:")
print(computer_choice)
if my_choice == computer_choice:
print('its a draw')
elif my_choice == 0 and computer_choice == 2 :
print("You won")
elif my_choice == 1 and computer_choice == 0 :
print ("You won")
elif my_choice == 2 and computer_choice == 1 :
print ("You won")
else :
print ("You lose")
I don't know what's wrong with this, but I am not able to get winner. All my results are "You lose", though I included all my winning possibilities.
CodePudding user response:
computer_choice is an element of list (which is a terrible name, btw), and thus will never be equal to any number.
