I tried using int() to convert the input into int, but I just get a TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'. How do i solve this?
import random number = random.randint(1, 50) lives = 10 guess = int(print("Enter a number between 1 and 50: ")) while guess != number and lives != 0: if guess > number: guess = int(print("Your guess is higher than the secret number. Enter another guess: ")) lives -= 1 else: guess = int(print("Your guess is lower than the secret number. Enter another guess: ")) lives -= 1 if guess == number: print("You win!") else: print("You lose!")
print()will just output a value but not take user input. Useinput()insteadint(input('Say something'))