You know how to store data in objects with attributes. But objects can also do things! A method is a function defined inside a class. Just like "hello".upper() calls the upper() method on a string, you can create your own methods.
↗️
Loading editor...
↶
↷
greet is a method. Just like __init__, it takes self as the first parameter. We call it with myCdm.greet() — Python automatically passes myCdm as self.