I'm trying to make a program where I can type a number n
and then I would like to generate a random number between 1 and 2. If this random number is the same as n
, it would show "You won!" and if not, "You have lost." But even when you hit the number, it's showing "You've lost!".
Here's my code. Thank you.
from random import randint
n = (input('Digite um número: '))
print (randint( 1, 2))
if n == (randint):
print ('Você ganhou!')
else:
print ('Você perdeu!')