import random
random_number = random.randint(1, 99)
user_guess = 1
print(random_number)
while user_guess != random_number:
user_guess = int((input('Guess the number between 1 and 99: ')))
if user_guess == (''):
print('\\nWe need a number please!\\n')
if user_guess >= 0:
if user_guess > random_number:
print('\\nNumber too large!\\n')
elif user_guess < random_number:
print('\\nNumber too small!\\n')
else:
print('\nCongratulations!!! \nYou\'ve picked the correct number.')
This is the issue is, if the user presses enter in the input without entering a number.
I understand when return is pressed without entering a value, it returns a string, but the input needs to be an integer. I get the following error: ValueError: invalid literal for int() with base 10: ''
I'm teaching myself Python, very new, and would welcome some help to fix the issue.