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 trialKent Utomo
652 Pointsi don't know how to answer ,stage 3 out of 3 "Things that count" python
please help me
age = 13
days = (age*52*7)
estimate = round(days)
summary = "I am
1 Answer
Stone Preston
42,016 Pointsyou need to use the format function.
you can use the format function on a string by placing {} inside a string and calling .format() on the string itself. you can pass in variables to the format function and their values will be inserted where the {} are.
for example, If I had two variables named x with a value of "py" and y with a value of "thon" and wanted to place them in a string somwhere I could use:
"this is {} and this is {}".format(x, y)
the value of x would be inserted where the first {} is and the value of y inserted into the next one to create a string that said 'this is py and this is thon"
so if we want to insert the value of estimate into the string we could use
age = 13
days = (age*52*7)
estimate = round(days)
#value of estimate is inserted where {} is
summary = "I am {} days old!".format(estimate)
you can read more about the format method in the documentation