Python Forum

Full Version: Issues with printing a variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am back to working on homework and I have a very simple problem that I can't seem to figure out

I am trying to print a variable as part of a string and it doenst seem to like it

# Create a program that asks the user to enter their name and their age. Print out a message addressed
# to them that tells them the year that they will turn 100 years old.

name = input ("Please enter your name: ")
age = input ("Now please enter your age: ")

num=100 - int(age)
newdate = 2017 + num


print ('You will be 100 in newdate')
If I print newdate by itself no problem, if I print the string no problem, if I print the string then new date after '' problems. And then the above problems. If I try turning the value into a string and then printing it still a problem

solved it just needed a comma. Thanks!
The string formatting tutorial on our forum will be perfect help for your task.

Ah you got it solved already, great to know :)