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

thanh trung
thanh trung
4,246 Points

stage 3 things that count

at the stage 3 things that count . i dont understand task 4 of 4. can anyone explain?

3 Answers

Stephen Bone
Stephen Bone
12,359 Points

Hi thanh

The first part of the task is to create a variable called estimate and assign it the rounded value of decades. So this is done by using the round function passing in decades as a parameter. The structure is below but I've left out the actual values so that you can drop them in:

variable = round(parameter)

Second part is then to use String Formatting to replace the place folders {} with the values stored in the variables you've created in the previous tasks. Again I've given you the structure below but left out the actual values:

variable = "I am {} days old! That's about {} decades!".format(first_param, second_param)

Hope it helps!

Hey Thanh!

This is the code that you will need for the whole code challenge! The last 2 lines are the ones that are added during task 4.

age = 16
days = age * 52 * 7
decades = age / 10
estimate = round(decades)
summary = "I am {} days old! That's about {} decades!".format(days, estimate)

Estimate is set to equal a rounded version of decades. Summary is set equal to a string and the values 'days' and 'estimate' are passed in using string formatting.

If you need any further help with this let me know!

-Luke