Python class

Python class provides it Object Oriented Programming (OOP) capabilities. Python class supports inheritance.

class human:
name = 'unknown'
def speak(self, word): #use self as the 1st argument
print (word)

>>> Jack = human()
>>> Jack.name = "Jackson Martin"
>>> Jack.speak("I am Jackson Martin")
I am Jackson Martin
Inherit class employee from class human:
class employee(human):
department = 'unknown'
def showdepartment(self):
print (self.department)

>>> Jack = employee()
>>> Jack.name = "Jackson Martin"
>>> Jack.department = "IT"
>>> Jack.showdepartment()
IT