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 trialMUZ140057 Dumisani Nyamusa
8,029 Pointspython basic
create 2 new variables named estimate that holds the rounded number of days you have lived and one named summary that adds the string version of estimate into "I am {} days old.
1 Answer
michaelangelo owildeberry
18,173 PointsDid your question get answered? =)
John Domingo
9,058 PointsJohn Domingo
9,058 PointsHey MUZ140057 Nyamusa!
In the Things That Count Challenge Tasks, you declared a variable called age and set it to your age:
age = 24
In Task 2, you should have created a variable called days by multiplying your age by 52 (weeks) and 7 (days):
days = age * 52 * 7
Recall the function round(number[,ndigits]) which will take a number and round it up or down based the nth digit you specify to the right of the decimal place (ndigits).
By default, if you just call round(number) and omit the ndigits the function will return a floating point number that has been rounded to zero places after the decimal.
estimate = round(days)
Lastly, the task asks us to use the curly brackets {} a string placeholder. If you remember, the placeholder can be filled using the string.format() function. Simply feed in the estimate variable to the format() function to create the summary variable.
summary = "I am {} days old!".format(estimate)
Best of luck!