How do you write a statement to prompt a user for their name and age
I want the output to be in this form:
Hello ____, next year you will be ____ years old!

I had a go and could only get up to this bit:

yourname= input("What is your name? ")
age = int(input("How old are you? “))
nextyear = age+1
print(‘Hello yourname, next year you will be (nextyear)) years old!”)


Hi @emerald_56,

Are you using Python 3.x? If it is Python 2.x, use raw_input instead of input.

For the output …

print("Hello, {:s}, next year you will be {:d} years old!".format(yourname, nextyear))


I’m using the python 3.5.2 version
Would it be the same


Python 3.5.2 qualifies as a Python 3.x version.

  • Use input rather than raw_input.
  • print is a function, so enclose any arguments within parentheses, as would apply when calling any function.
  • Regarding mathematics, the /operator performs float division, even when both operands are ints.

For information about differences between versions 2.x and 3.x, see Should I use Python 2 or Python 3 for my development activity?.


Thank you so much! :slight_smile: