Python - Input and Output
What will be the output of this code if the user types
25 when asked?
age = input('Enter your age: ')
print(age + 5)25 when asked?
age = input('Enter your age: ')
print(age + 5)age will be the string '25', not the number 25.age + 5 attempts to add a string and an integer. In Python, this causes a TypeError, but if the code was print(age + '5'), it would concatenate to '255'. Since the code is print(age + 5), it raises a TypeError.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions