Skip to content

Created rock_paper_scissor.py #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Python/rock_paper_scissor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import random

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

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

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

game_choice = [rock, paper, scissors]

user_choice = int(
input(
'what do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n'
))
print("You chose")
print(game_choice[user_choice])

computer_choice = random.randint(0, 2)
print("Computer chose")
print(game_choice[computer_choice])

if user_choice >= 3 or user_choice < 0:
print("You entered invalid no, You loose!")
elif user_choice == 0 and computer_choice == 2:
print("You Win!")
elif user_choice == 2 and computer_choice == 0:
print("You Loose!")
elif user_choice > computer_choice:
print("You Win!")
elif computer_choice > user_choice:
print("You Loose!")
elif user_choice == computer_choice:
print("It's Draw")