Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

someone please help i cant seem to figure out what i'm doing wrong

python Basic

days_alive.py
age = 73;
days = age*7*52;
summary = string(days) + ("I am {} days old!".format(days))

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

Shezan Kazi
Shezan Kazi
10,807 Points

Hi,

I don't know my way around python, but my guess is since you are writing the entire string into brackets, the program does not interprete the curly brackets.

Try something like this instead:

age = 73
days = age*7*52
summary = "I am {} days old".format(days)

This might work. I don't see why you added the string(days) after declaring the variable summary

Please also see this link: https://en.wikibooks.org/wiki/Python_Programming/Variables_and_Strings#Strings_and_Variables

3 Answers

C H
C H
6,587 Points

You basically have it! Python doesn't use ';' at the end of lines, and you have too much in the last variable.

age = 73
days = age*7*52
summary = "I am {} days old!".format(days)

Hi Chevano!

You're very close! The first two lines are correct (other than the semi-colons at the end, which, as others have mentioned, you don't need to use in Python.)

The trouble comes in the third line, when you include the first string(days). You actually don't need that there! It is sufficient to do it just one time, later within the .format() call.

Also, the method for turning a variable into a string is actually str() not string(), so your third line should look like this:

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

I hope this helps!

Be Well, Graham

Daniel Santos
Daniel Santos
34,969 Points

I think you have quite a few good answers! Let them know if it helped.

Happy coding.

-Dan

thank you that was helpful