What happens is that when I run my program, the output repeats the questions more than usual (sometimes 4 times sometimes 2 or 1).
My mistake may be because I call the functions many times or because I misuse the if statement but I'm not sure. Can you get me out of doubt? Thanks in advance.
def respuesta_pc():
compu_respuesta = input('esta es la respuesta de la computadora:')
return compu_respuesta
def respuesta_humana():
huma_respuesta = input('esta es tu respuesta')
return huma_respuesta
if respuesta_pc()== 'roca' and respuesta_humana() == 'papel' :
print('el papel le gana a la roca.tu ganas')
elif respuesta_pc() == 'roca' and respuesta_humana() == 'tijera' :
print('la roca le gana a la tijera. tu pierdes')
elif respuesta_pc() == 'roca' and respuesta_humana() == 'roca' :
print('es empate')
else:
print('tu respuesta no es valida')
The program is just beginning, so I'm testing the answers with rock.
Answer by pc = rock
Your answer = (the one you want)