Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (Retired) Things That Count Things That Count

Problem with task 3 Python Basics

I'm unable to do task 3 :'( and I've no idea how to have the right answer ! I don't understand...

age = int(23)

days = int(23*52*7)

summary = 

3 Answers

Hi Lucie

Task 3 asks you to create a variable named summary where you substitute the {} for your variable days. As stated above this is done using the format method of the string function. On another note you don't need to convert your values to integers as the compiler will pick this up automatically. So only convert datatypes when you have the following scenario. For example you would attempt to convert from a string to integer when you have something like this a=23 and b="25" and c= a * b which would throw an error as b is a string a not an integer. So the correct approach would be c = a * int(b).

age = 23

days = 23*52*7

summary = "I am {} days old!".format(days) 
# you could convert days to a string if you wanted to but its not needed.  

hope this helps a bit with datatypes as well.

29,445 Points

The answer is

summary = "I am {} days old!".format(days)

You can look up again this https://teamtreehouse.com/library/python-basics/ins-outs/string-formatting video for explanation how and why :)

Thank you ! I've tried so many possible answers but it wasn't the exactly one :) I've to work a lot ^^...