Source Code:
(back to article)
class MyClass: def __init__(self, name): self.name = name def print_name(self): print(self.name) my_instance = MyClass("John") my_instance.print_name() # prints "John"
Result:
Report an issue