Rock Paper scissor game using Python by Angela yu

 Make a rock paper scissor game using python.

import random

rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''

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

scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''

game_images = [paper, scissors,rock]

user_Choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.: "))

if user_Choice >= 3 or user_Choice < 0:
print("you typed an invalid number, you lose.")

else:
print(game_images[user_Choice])


computer_Choice = int(random.randint(0,2))
print("Computer choice: ")
print(game_images[computer_Choice])



if user_Choice == 0 and computer_Choice == 2:
print("you wins!.")
elif computer_Choice == 0 and user_Choice == 2:
print("you lose!")
elif computer_Choice == 1 and user_Choice == 2:
print("you wins!.")
elif user_Choice == 1 and computer_Choice == 0:
print("you wins!")
elif computer_Choice > user_Choice:
print("you lose!")
elif computer_Choice == user_Choice:
print("It's a draw.")


Post a Comment (0)
Previous Post Next Post