This commit is contained in:
2025-06-11 23:19:45 +02:00
parent 9e56bb175e
commit e8c189df76

View File

@ -1,8 +1,32 @@
# 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 import random
rand = random.randint(1, 2) moves = ["Rock", "Paper", "Scissors"]
if rand == 1: player_move = int(input("What do you choose? Type 0 for Rock, 1 for Paper and 2 for Scissors.\n"))
print("Heads") 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: else:
print("Tails") print("You lose!")
# 2 beats 1
# 1 beats 0
# O beats 2