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

Akeno Morrell
Akeno Morrell
2,239 Points

Part 4 of python challenge task am not sure what its asking me to do

final should look like?

3 Answers

Here is the code:

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

The format automatically converts any number, boolean and any other types to a string.
I know that by the documentation: format(...) format(value[, format_spec]) -> string Hope that helps :smiley:

Maxim Kontsevitch
Maxim Kontsevitch
25,447 Points

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

Akeno Morrell
Akeno Morrell
2,239 Points

ok well i wanted to know how you get the days and estimate to strings since it needed to be strings this what i did "I am " + str(days) + " days old! That's about" + str(decades) + " decades!" I didnt understand that days and decades needed to be string to set to summary but understand..... and does the format method does this automatically? as u showed me it much easier i would say...