String Method format


The lesson before this prints the length of parrot with the following code:

print len(parrot) = 14

The code below shows the method name, then 'dot' then the variable name, finally open and close parentheses.
How to know if the format on how to use a method is like the code above or the code below?


parrot = "Norwegian Blue"

print lower.parrot()


Don't worry there is lesson about it Dot Notation

from lesson:

Methods that use dot notation only work with strings.

On the other hand, len() and str() can work on other data types.


Oh is that so? Super thanks Sir!


it should be:


you seemed to have swapped the variable and method name.

That is the tricky question, the problem is that both function and classes haven't been covered yet. For know, i am afraid you will just have to remember (write it down)

I could explain the difference, but i am afraid this will be only be more confusing for the moment.

Once you learned a bit about function, we can come back to this issue?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.