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!

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

Harsh Kumar Woike
Harsh Kumar Woike
204 Points

problem (things that count)

I have been given 3 tasks in python basics 'things that count' section. the three tasks are: 1) Create a variable named 'age' that contains your age. (i have completed this task) 2) Now, create a variable named 'days' that is your age multiplied by 52 and multiplied by 7. (i completed this too.) 3) Finally, create a new variable named 'summary' that inserts days into the string "I am {days} days old!" I am not able to complete the 3 task which asks me to create a new variable named 'summary'. please help. thanks.

1 Answer

Are you using the string.format() method? I'm guessing you might have written this:

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

... which will throw a KeyError. Instead try one of the following:

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


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

[MOD: Added ```python formatting -cf]