0
Hi, what's wrong with this code? Because it print wrong for all guesses.
Generate a random number between 1 and 10. Ask the user to guess the number and print amessage based on whether they get it right or not From random import randint a=eval(input(guess a number:)) random_number=randint(1,10) If a==random_number: Print("right") else: Print("wrong")
3 Answers
+ 1
the code works idk what u mean you could write another elif to check if the user is close
+ 2
Because, the generated random number never equal to a.
Keep trying, it returns right sometimes.