Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMicheal Charles
626 Pointswhat did I do wrong unknown?
age = 50 days = (age *52 * 7) summary = print("I am str{} days old!".format(days))
age =50
days = age * 52 * 7
summary = print("I am str{} days old!".format(days))
1 Answer
Ryan Ruscett
23,309 PointsHey,
You are close, it is definitely a good effort.
WHAT YOU DID Print is a function. You are trying to save a function that prints to the console. It doesn't actually return anything.
age =50
days = age * 52 * 7
summary = print("I am str{} days old!".format(days))
WHAT I DID Now, I did the age and multiplication different, just for the sake of doing it different. Yours works too but I wanted to show another way to do it for fun lol
What you need is a string, but {} indicates it's a formatted string. So str.format() allows me to format a string. The first argument is the string and the second argument is what goes into the {} within the string.
age = 30
days = 30 * (52 * 7)
summary = str.format("I am {} days old!", days)
Does this help clear it up for you? Let me know if not and I can explain it further.
Thanks!
Micheal Charles
626 PointsMicheal Charles
626 PointsThanks, perhaps I missed it in the video lecture, your answer is clear. But I will need to do some independent search on how to use the 'format()' still to be comfortable with it. I am a true beginner Again thanks.
Ryan Ruscett
23,309 PointsRyan Ruscett
23,309 PointsSure,
Here is a good tutorial.
Format in Python