반응형
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")
반응형
'파이썬 > exercise' 카테고리의 다른 글
5-2. python 최고/최소 점수얻기(for반복문 연습) (0) | 2023.01.04 |
---|---|
5-1. python 학생 평균키 구하기(for반복문 연습) (0) | 2023.01.04 |
4-2. python nested list 보물지도 (0) | 2023.01.03 |
4-1. python random module, 동전 앞 뒤 무작위 (0) | 2023.01.03 |
3-4 python treasure island (0) | 2022.12.27 |