BIT BY BYTE
Back
Question 1 of 8
3 marks
A student writes `age = input("Enter your age: ")` and then `print(age + 1)`. The program crashes with a TypeError. Explain why, and state how to fix it.
The variable `age` must be declared before use
`input()` returns a string. You cannot add 1 to a string — fix: `age = int(input("Enter your age: "))`
`print()` cannot perform arithmetic — use a separate variable
`input()` returns None if no text is entered
Check Answer