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 trialtehfdsjfio
Courses Plus Student 2,075 PointsI 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
5,258 PointsIts 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
tehfdsjfio
Courses Plus Student 2,075 PointsFinally, 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
Treehouse Guest TeacherYou need to use the .format()
method on your summary
string to put the values into the right places.
tehfdsjfio
Courses Plus Student 2,075 PointsIts 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
Treehouse Guest TeacherLike 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"
.
tehfdsjfio
Courses Plus Student 2,075 PointsThanks 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
Treehouse Guest Teacher'days'
is not the variable days
, it's a string. Remove the quote marks from around your variable names.
tehfdsjfio
Courses Plus Student 2,075 PointsOkay, I will wait till the end of this course. Its fun to code. I enjoyed your classes.
Thanks, Hussein.
tehfdsjfio
Courses Plus Student 2,075 PointsIt worked :). thanks.
Is there a similar questions that I can practice?
Kenneth Love
Treehouse Guest TeacherNot in our course, but codingbat has lots of Python tests. Some of them might be a bit beyond what's in Python Basics, though.
tehfdsjfio
Courses Plus Student 2,075 Pointstehfdsjfio
Courses Plus Student 2,075 PointsHow 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
Treehouse Guest TeacherKenneth Love
Treehouse Guest Teachercd
into the directory and run the file like normal.