32 lines
784 B
Python
32 lines
784 B
Python
# import random
|
|
|
|
# rand = random.randint(1, 2)
|
|
|
|
# friends = ["Alice", "Bob", "Charlie", "David", "Emmanuel"]
|
|
# # lucky_friend = friends[random.randint(0, len(friends)-1)]
|
|
# lucky_friend = random.choice(friends)
|
|
|
|
# print("Who pays the bill?")
|
|
# print(f"Iiiiiiiiiits {lucky_friend}!")
|
|
|
|
import random
|
|
|
|
moves = ["Rock", "Paper", "Scissors"]
|
|
|
|
player_move = int(input("What do you choose? Type 0 for Rock, 1 for Paper and 2 for Scissors.\n"))
|
|
cpu_move = random.randint(0, 2)
|
|
|
|
print(f"You played {moves[player_move]}")
|
|
print(f"CPU played {moves[cpu_move]}")
|
|
|
|
player_vs_cpu = [player_move, cpu_move]
|
|
|
|
if player_vs_cpu[0] == player_vs_cpu[1]:
|
|
print("Draw")
|
|
elif player_vs_cpu in [[2,1], [1, 0], [0,2]]:
|
|
print("You win!")
|
|
else:
|
|
print("You lose!")
|
|
# 2 beats 1
|
|
# 1 beats 0
|
|
# O beats 2 |