티스토리 뷰

Test/Python(20220101~)

Day4_가위바위보

kiostory 2022. 1. 5. 19:32
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''

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

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

#Write your code below this line ?

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

if choice == 0 :
print(rock)
elif choice == 1 :
print(paper)
elif choice == 2 :
print(scissors)
else :
print("Choose the correct one.")

import random
computer_chose = random.randint(0,2)

print(f"Computer chose \"{computer_chose}\".\n\n")

if computer_chose== 0 :
print(rock)
elif computer_chose== 1 :
print(paper)
elif computer_chose== 2 :
print(scissors)

if choice == computer_chose :
print("\nDraws.")
elif (choice==0 and computer_chose==2) or (choice==1 and computer_chose==0) or (choice==2 and computer_chose==1) :
print("\nYou win.")
else :
print("\nYou lose.")

'Test > Python(20220101~)' 카테고리의 다른 글

Day6_미로탈출  (0) 2022.01.07
Day6_While loop  (0) 2022.01.07
Day6_Style Guide for Python Code  (0) 2022.01.07
Day5_비번 생성기  (0) 2022.01.06
Day5_반복문 for  (0) 2022.01.05
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함