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) Say Hello to Python Help Hotline

help(str().center) should work too, right? It works on Python version 2.7.8 and not on this quiz.

The answer I submitted was marked incorrect when it actually does do what the question asked. Most Python packages haven't been converted to Python 3+ so I've stuck with 2.7 until it's worthwhile to upgrade. However, perhaps my answer above doesn't actually work on 3+?

3 Answers

Since str is used an object in this case, there is no need for the parenthesis (but they still can be there and it is valid syntax). I guess the question only wants the answer excluding the parenthesis because that is what is shown in the video.

David Bouchare
David Bouchare
9,224 Points

Hi Jordan,

It seems that you don't need the () after the str. As it is a method that belong to that str class. So str.center should be working.

-- Edit. Looking at John's answer below, I've tested it with Python 3 and help(str().center) and it works indeed. Thanks for pointing this out

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

help(str().center) works fine in my Python 3.4 interpreter. I'll update the quiz question to accept that answer as well.

And, to address a point in the middle of your post, Python 3.4 has tons of packages and support available. The story that it's not widely adopted yet is wildly out of date and wrong.

Thank you for pointing out my incorrect statement, that was egregious on my part. So yes, in general roughly 75% of the top 360 packages have been updated to support Python 3+, which is way more than when I last checked (http://py3readiness.org/).

Unfortunately, I'm dealing with a lot of legacy code with an entire infrastructure developed over the past several years on Python 2.x. However, understanding that it really is time to upgrade is exciting. So again, thank you!