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

days_alive.py Task 1 no longer working

I can complete task 1 and 2, but when I attempt to make the summary variable I get a message saying task 1 is no longer working. I'm not sure if it is my attempt at the summary variable that is breaking it or not.

6 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Sometimes the validation is a stickler. Your string has an extra space after the 'old!' Try removing the space.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

This code worked for me:

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

Note: the above code was added using an iPhone. With the narrow screen, I had to aggressively wrap my lines!

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

It would help to post your code. When you see "task 1 is no longer working" it can mean a syntax error has been introduced. Use the "Return to task 1" to run the failing code in task 1. If no return button is present, copy your current task 2 solution and reload the page to get back to task1.

age = 25
days = (age * 52) * 7
summary = ("I am {} days old! ".format(days))
Kenneth Love
Kenneth Love
Treehouse Guest Teacher

This passes for me. Are you still getting a Bummer message?

Kyle Hahnel
seal-mask
.a{fill-rule:evenodd;}techdegree
Kyle Hahnel
Python Web Development Techdegree Student 5,670 Points

I had to remake my account, didn't know I get a company discount ;)

It passed when I made my way back to this section and entered the text again.

I am little confused why we have to put .format(days) I think it has to do with {} that I am confused about it's part of the string are we using that to cal days?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

The .format() isn't strictly required by Python, the challenge asks for it because it's good style.

As a beginner, you could have build up the string using the less favored string addition

# string addition
summary = "I am " + str(days) + " days old!"

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

# there is also the old % format - Don't use (revisit when you get to python logging)
summary = "I am %s days old!" % days

The {} is a replacement field marker used by .format(). Each field is replaced with items in the .format() argument list. Some examples can be found here