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 (2015) Python for Beginners Second Quiz

Siu Chung LEUNG
Siu Chung LEUNG
742 Points

Dont quite understand this question. What does it mean by str upper class?

As I asked..

1 Answer

Ryan S
Ryan S
27,276 Points

Hi Siu Chung Leung,

The question is more about how to use the "help" function in the python shell than about the details of the str.upper method. The correct answer is the following:

>>> help(str.upper)

You can use the help function in this way for all kinds of things. It will give you information on what methods are available and how to use them.

Regarding the details of the str class and it's methods, you'll learn more about classes in the object-oriented Python course. For the purposes of python basics, all you need to know is that all data types, like strings (str), integers (int), lists, etc., are objects and have certain methods specific to each type that can be called upon when you need them.

For example, the .upper() method will make all the letters in a string uppercase. But you wouldn't be able to use this method on an integer. You'd get an error if you tried.

>>> some_string = "This is a string"
>>> some_string.upper()
'THIS IS A STRING'

>>> var_1 = 5
>>> var_1.upper()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'upper'

Hope this clears things up.