Practice question from Python Introduction
What will happen with this code? A. years equals 75 B. years equals "75" C. TypeError occurs D. years equals 100 E. NameError occurs
age = input("Age: ") # user enters 25
years = 100 - ageAnswer
C
Explanation
input() returns a string ("25"), and you cannot subtract a string from a number. You must convert it first: age = int(input("Age: "))