I’m practicing and trying to make a program that tells you how many years it is until your 100. It works perfectly when line 1 is raw_input("What’s your name? "), but python 3.0 only has input so I was trying to use that. I’ve also tried using name = input("what’s your name? ") and converting it to a string after but I still get the same error. Any Idea what I’m doing incorrect?
Error I get is:
What’s your name? garrett
Traceback (most recent call last):
File “python”, line 1, in
File “”, line 1, in
NameError: name ‘garrett’ is not defined
name = str(input("What's your name? "))
age = int(input("What's your age? "))
years = 100 - age
printNum = int(input("How many times do you want to print it? "))
def timesPrint(printNum):
while printNum > 0:
print "I see that you're " + str(age) + ". That means you'll be 100 in " + str(years) + " years!"
printNum -= 1
timesPrint(printNum)