Why doesn't this work?
shazbot (0)

Using Python, this is my code (This is actually from a college course)

age = input("How old are you ")
print("You are", age, "years old.")
print("You have", 65 - age, "years until you can retire.")

I get this error after I enter my age:

Traceback (most recent call last):
File "main.py", line 3, in <module>
print("You have", 65 - age, "years until you can retire.")
TypeError: unsupported operand type(s) for -: 'int' and 'str'

I've tried to edit it a bunch of different ways, but I can't get it to perform this simple calculation.

You are viewing a single comment. View All
Answered by ArchieMaclean (596) [earned 5 cycles]
View Answer
shazbot (0)

@ArchieMaclean that worked, thank you for the explanation :).