Rock Paper And Scissor Game with Python
Here is the code for Rock paper and scissor game
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
user_input = input(" Choose any one number corrospond from the list-- 1: Rock, 2: Paper and 3: scissors \n")
user_input = int(user_input)
import random
computer_choice = random.randint(1, 3)
possible_list = [rock, paper, scissors]
if user_input < 1 or user_input > 3:
print("Input again")
else:
if computer_choice == user_input:
print(f"Computer choice is: \n {possible_list[computer_choice-1]}")
print(f"Your choice is:\n {possible_list[user_input-1]}")
print("Draw")
elif computer_choice == 1 and user_input == 2:
print(f"Computer choice is: \n {possible_list[computer_choice-1]}")
print(f"Your choice is:\n {possible_list[user_input-1]}")
print("You won")
elif computer_choice == 2 and user_input == 3:
print(f"Computer choice is: \n {possible_list[computer_choice-1]}")
print(f"Your choice is:\n {possible_list[user_input-1]}")
elif computer_choice == 3 and user_input == 1:
print(f"Computer choice is: \n {possible_list[computer_choice-1]}")
print(f"Your choice is:\n {possible_list[user_input-1]}")
print("You won")
else:
print(f"Computer choice is: \n {possible_list[computer_choice-1]}")
print(f"Your choice is:\n {possible_list[user_input-1]}")
print("Computer won")
Comments
Post a Comment