class constructor python code example
Example: python class constructor
class Human:
def __init__(self, name):
self.name = name
h1 = Human("Bob")
print(h1.name) # prints Bob, the name passed from constructor
class Human:
def __init__(self, name):
self.name = name
h1 = Human("Bob")
print(h1.name) # prints Bob, the name passed from constructor