Welcome to the Treehouse Community
Looking to learn something new?
Structural Difference of Functions?
What is the difference between the way this two functions are working.:
praise.upper() and len(praise)
I don't understand the structure which they are following. praise.upper() - On the first one you are assigning the functions with .upper
Len(praise) - One the second one you are using () where you are entering the variable inside?
Steven Parker215,940 Points
The first one is a method. That's a special kind of function that is also an object member. It can only be accessed using the membership operator (the period) on an object of the correct class. I assume "praise" is a string, since "upper" is a common method of strings. A method might take arguments in the parentheses, but they don't need to if they only act directly on the object they are called on.
The second form is an ordinary function. It can be accessed anywhere, and any values it needs are passed as arguments inside the parentheses.