파이썬/exercise
4-3. python 가위바위보 게임
태지쌤
2023. 1. 4. 09:26
반응형
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
user_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n"))
computer_choice = random.randint(0,2)
if user_choice == 0:
print(rock)
elif user_choice == 1:
print(paper)
else:
print(scissors)
print("-"*50)
if computer_choice == 0:
print(rock)
elif computer_choice == 1:
print(paper)
else:
print(scissors)
if user_choice == computer_choice:
print("draw")
elif (user_choice == 0 and computer_choice == 2):
print("win")
elif (user_choice == 1 and computer_choice == 0):
print("win")
elif (user_choice == 2 and computer_choice == 1):
print("win")
else:
print("lose")
반응형