반응형
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
game = [rock,paper,scissors]
user_choice = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors"))
# print(game[user_choice])
computer_choice = random.randint(0, 2)
if user_choice == computer_choice:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
elif user_choice ==2 and computer_choice ==1:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
print("Result in the computer win. You are win")
elif user_choice ==2 and computer_choice ==0:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
print("Result in the computer win. You are loss")
elif user_choice ==0 and computer_choice ==1:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
print("Result in the computer win. You are loss")
elif user_choice ==0 and computer_choice ==2:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
print("Result in. You are WIN")
elif user_choice ==1 and computer_choice ==0:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
print("Result in. You are WIN")
elif user_choice ==1 and computer_choice ==2:
print("you selected\n")
print(game[user_choice])
print("The computer selected\n")
print(game[computer_choice])
print("Result in. You are loss")
For example. Let's see. When i choice number 2, below is one of case result.
What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors 2 you selected _______ ---' ____)____ ______) __________) (____) ---.__(___) The computer selected _______ ---' ____) (_____) (_____) (____) ---.__(___) Result in the computer win. You are loss Process finished with exit code 0 |
반응형
'IT' 카테고리의 다른 글
Create the vjunosswitch image on EVE-NG (0) | 2024.03.28 |
---|---|
let's test for mc (2) | 2024.02.29 |
IGMP version 2 (0) | 2024.02.28 |
Random MAC address (1) | 2024.02.28 |
Take configure for Loadbalancer on Ubuntu (0) | 2024.02.03 |