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

Having trouble with this question: To get help for the method center that belongs to the str class, I'd use ________.

Python Help

4 Answers

Ricky Catron
Ricky Catron
13,023 Points

You would call the help function with str.center as the argument.

help(str.center)

the "." is how you access the atrributes and methods of a class.

irene devlin
irene devlin
330 Points

tried this does not work in the answer

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

It definitely does work in the quiz. I just tested it again to be certain.

thank you first i was just trying r not the full command thank you for your quick answer.

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You can see all of the methods that strings have by using dir(str) like we did in the video. Looking through that list, the center method looks like an good candidate, and, as Ricky Catron said, you can check what it actually does with help(str.center).

Sagar Koradia
Sagar Koradia
4,456 Points

Kenneth Love : help(str.center) is not working in the above question.

Que: To get help about the rjust method in the str class, I'd use help( ___________ ).

Answer: that i need to write is str.center in the blank.

but it is not working. Kindly guide me.

I am not sure what I am doing wrong here. For the answer to the question I am copy and pasting str.center and tried typing it in and I am not getting the right answer. what am i doing wrong? Thank you Nate

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

nathon Reed be sure to read the question. It's not asking about str.center.