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 trialAkeno Morrell
2,239 PointsPart 4 of python challenge task am not sure what its asking me to do
final should look like?
3 Answers
nvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsHere 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
25,447 PointsThe 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
Maxim Kontsevitch
25,447 PointsDoes 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
2,239 Pointsok 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...