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

Python is hard! help

This is hard for me..

QUESTION:

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

days_alive.py
age = 18
days = age * 52 * 7
summary = print("I am {} days old"(days))

1 Answer

Hi Felix,

You're doing great!

For this last task in the challenge, we don't need to print anything - we just need the variable summary to hold a string with our variable concatenated or use a formatted string.

Let's look at string concatenation first.

age = 18
days = age * 52 * 7

# python doesn't like numbers concatenated with strings,
# so we have to explicitly cast numbers into strings with str(number)
summary = "I am " + str(days) + " days old"

Finally, here's a version using String Formatting

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

Your code was really close to this - it was just missing the .format after the string and the challenge doesn't want us to print it, just assign to summary.

Hope this helps,

Cheers

Thanks!