0
I’m trying to make a game of jokenpo but it’s gone wrong.
from random import choice
from time import sleep
print('[1]PAPEL\n'
'[2]TESOURA\n'
'[3]PEDRA')
escolha = input('Qual a sua escolha? ')
print('JO')
sleep(1)
print('KEN')
sleep(1)
print('PÔ')
lista = [1,2,3] #1(PAPEL),2(TESOURA),3(PEDRA)
pc_escolha = choice(lista)
if escolha == 1 and pc_escolha == 3 or escolha == 3 and pc_escolha == 2 or escolha == 2 and pc_escolha == 1:
print('-*'*20)
print('VOCÊ JOGOU {} E O COMPUTADOR JOGOU {}\n'
'VOCE VENCEU'.format(escolha,pc_escolha))
print('-*'*20)
elif escolha == pc_escolha:
print('-*' * 20)
print('VOCÊ JOGOU {} E O COMPUTADOR JOGOU {}\n'
'EMPATE'.format(escolha, pc_escolha))
print('-*' * 20)
elif pc_escolha == 1 and escolha == 3 or pc_escolha == 3 and escolha == 2 or pc_escolha == 2 and escolha == 1:
print('-*' * 20)
print('VOCÊ JOGOU {} E O COMPUTADOR JOGOU {}\n'
'O COMPUTADOR VENCEU'.format(escolha, pc_escolha))
print('-*' * 20)
What is going wrong? In which line is the problem? what should I do and what does?
– Barbetta
vc should use ( ) to separate the conditions from if where they relate to each other, (a and b) or ( b and c) or (c and d)
– Elton Nunes
Simply does not appear output. It was to appear the contents contained within the repetition structures.
– Tankilaine
@Eltonnunes, it didn’t work
– Tankilaine
ok, I looked over quickly, you’re comparing integer in if, but input returna str, vc Dve do int(input())
– Elton Nunes
Exactly what Elton said, I deleted my answer because I had not seen that the friend had already answered in the comments.
– Murilo Portugal
I didn’t realize this silly mistake. These mistakes are the worst because the system doesn’t warn you. I thank you.
– Tankilaine