-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.py
32 lines (24 loc) · 1.1 KB
/
game.py
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
32
import random
while True:
print("### Bem-vindo ao Pedra, papel e tesoura! ###")
jogador = input("Digite o nome do jogador: ")
print()
print(jogador.capitalize())
opcoes = ['pedra', 'papel', 'tesoura']
escolha_bot = random.choice(opcoes)
escolha_jogador = input("Escolha entre - Pedra | Papel | Tesoura: ")
# Se opcao nao existir
while escolha_jogador not in opcoes:
print("Escolha apenas entre as opções disponíveis!")
print()
print(jogador.capitalize())
escolha_jogador = input("Escolha entre - Pedra | Papel | Tesoura: ")
# Verificação de escolhas
if escolha_jogador == escolha_bot:
print (f"Empate... O bot escolheu {escolha_bot.capitalize()}.\n")
elif (escolha_jogador == 'pedra' and escolha_bot == 'tesoura') or \
(escolha_jogador == 'papel' and escolha_bot == 'pedra') or \
(escolha_jogador == 'tesoura' and escolha_bot == 'papel'):
print(f"Você venceu... O bot escolheu {escolha_bot.capitalize()}.\n")
else:
print(f"Você perdeu... O bot escolheu {escolha_bot.capitalize()}.\n")