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) Ins & Outs Ins & Outs

I don't understand the 3rd challenge code. I need help.

i don't understand the 3rd challenge code. I need help.

3 Answers

Khaleel Hamid
Khaleel Hamid
5,258 Points

Its telling you to join variables names to the email_greeting to form the sentence.

So like this.

name = "Khaleel"
treehouse = "Tree" + "house"
email_greeting = treehouse + " loves " + name

How do i open a file inside a folder. The teacher didn't show how to open a file inside a folder. Am trying to use the command python filename , but how about if a file is inside a folder.

Thanks for your help

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

cd into the directory and run the file like normal.

Finally, create 2 new variables, one named estimate that holds the rounded number of decades you've lived and, one named summary that adds the string version of estimate into "I am {} days old! That's about {} decades!" with the correct values added to it.

age = 22
days = age * 52 * 7
decades = age /10
estimate = round(decades)
summary =  "I Am {days} days old! That's about {estimate} decades ! " 

am getting error. What am I missing?

Thanks

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

You need to use the .format() method on your summary string to put the values into the right places.

Its been 45 mins just figuring out this question. I watched the video 3 times, I didn't understand this question. So I would like to see the correction. Thanks,

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Like I said, you need to use .format() on the string. In the videos, we've used placeholders in a string and then passed in values to fill those placeholders. That's exactly what you need to do here.

summary = "Hello {}, I'm {}".format('Hussein', 'Kenneth')

That'll make our summary variable be the string "Hello Hussein, I'm Kenneth".

Thanks for the example. however, am still getting error saying " Your estimate doesn't seem to be in your summary!"

summary = "I Am {} days old! That's about {} decades!" .format('days', 'estimate')

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

'days' is not the variable days, it's a string. Remove the quote marks from around your variable names.

Okay, I will wait till the end of this course. Its fun to code. I enjoyed your classes.

Thanks, Hussein.

It worked :). thanks.

Is there a similar questions that I can practice?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Not in our course, but codingbat has lots of Python tests. Some of them might be a bit beyond what's in Python Basics, though.