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

I don't understand this question To get help for the method center that belongs to the str class, I'd use ..............

To get help for the method center that belongs to the str class, I'd use .......... my answer is str.rjust

4 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,468 Points

You've learned that help on a class can be found by using:

help(cls)

center is a method of the string class. To get help on a class method, you can use:

help(cls.method)
Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

Substitute str for "cls", and center for "method".

I tried this answer and got error!

Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

Can you copy and paste exactly what you tried? Remember to replace "cls" with str, and the "method" with the name of the method you need help on, in this case center.

str.rjust

Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

you need to include the call to the help function by enclosing what you typed with "help()"

help(cls.method)

Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

Try putting your two answers together. Also, the question is asking about the center() method, not the rjust() method: