Occurs when trying to convert an empty string to an integer.
age = input("Enter your age: ")
number = int(age)
print(number)Enter your age:
Traceback (most recent call last):
File "reproduce.py", line 3, in <module>
number = int(age)
ValueError: invalid literal for int() with base 10: ''
age = input("Enter your age: ")
if age.strip() == "":
print("Please enter a number")
else:
number = int(age)
print(number)I just pressed enter without typing anything. input() returns an empty string in that case, which cannot be converted to int.