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 trial

Python Python Basics (Retired) Things That Count Things That Count

create a new variable named summary that adds the string version of days into "I am {} days old!".

Someone please help I cannot seem to figure out what I'm doing wrong. The task asks me to--- create a new variable named summary that adds the string version of days into "I am {} days old!".

What???

days_alive.py
age = 52
days = 52*52*7
summary = 

2 Answers

Hi Terence!

As Kristian mentioned, your code would be more efficient if you would use the age variable you assigned in task 1 in the statement assigned to the days variable in task 2, rather than just repeating the integer assignment.

Kristian's suggested code for task 3 is almost complete. Since the challenge is asking you to use the string version of days, you would actually want to use the following:

summary = "I am {} days old!".format(str(days))

If we unpack this, what it's saying is, "Take the days variable completed in task 2 and turn it into a string (that's what the str() operator does) because, remember, days is an integer, so in order to put it into the summary statement, we first need to turn it into a string. Then, take that string and put it in place of the {} in the sentence in quotes (that's what the .format() operator does.)"

I hope this helps! Please designate this as the Best Answer if it was most helpful to you.

Thanks! and Be Well, Graham

First, for task 2 you need to multiply your age by 52 and then by 7. Your method works, but it's not efficient because you're hardcoding the number 52 in that equation. Use the variable age instead:

days = age * 52 * 7;

Now for task three, you just need to use the format method, passing the days variable:

summary = "I am {} days old!".format(days);