0

Please help me fix this Python code. It always outputs you lose even if the numbers match.

#A simple Python game where you must guess a random number between 1 and 10 import random random_number = (random.randint(0,10)) user_input = input('Guess a number between 1 and 10 \n') print(int(user_input)) if user_input == random_number: print('You win!') else: print('You lose') print('It was ' + str(random_number)) https://code.sololearn.com/coV24xKBaPlk/?ref=app

10th Jan 2023, 12:26 PM
Elliot
1 ответ
+ 6
Line 3 wrap it around with int like you did the print You was comparing a str vs int
10th Jan 2023, 12:31 PM
Ion Kare
Ion Kare - avatar