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

Jeff McCullough
Jeff McCullough
5,874 Points

Python Basics Challenge Task 3

I can't get the third line to work. I'm getting an error saying that the variable "summary" needs to be a string. I just can't seem to get this to work without breaking any other parts of the code.

days_alive.py
age = 38
days = (int(age) * 52) * 7
summary = print("I am {} days old!".format(days))

2 Answers

Hi Jeff.

Well I can't be sure that my help is correct but you could try this (as the error says the summary variable has to be a string):

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

You don't need the print function because by declaring variables - what's on the right side get evaluated first and then written into the variable.

Jeff McCullough
Jeff McCullough
5,874 Points

That did work that way. Thanks Nejc.