Earn 20 XP


  • In Python, everything is an object (be it a list, string etc).

  • A method in Python is somewhat similar to function the only difference is that a method is dependent on the object while a function is independent of the object.

  • Can you recall we had used a function len() in the earlier modules? Well, this is a function. len() can be used on list, tuple, strings, dictionaries, etc. to get the number of elements in them. While append() is a method that is associated with list only. You cannot use append() method on any of tuple, strings or dictionaries. This append() is associated with list data type only.

  • Objects have various methods associated with them (depending on type of the object).

image.png