Class Object

#!/usr/bin/evn python

# Define a class as 'student'
class student:
    # Constructor with parameters
    # The first argument of constructor reference to the current instance of the class
    def __init__ (self, name, science, history, math): = name
        self.marks = science + history + math
    # Method of the class
    def displayMarks(self):
        print("Total marks of",, "=", self.marks)
# 'stu1' & 'stu2' are the object of the class 'student'
stu1 = student("James", 50,60,80)
stu2 = student("Jonh", 80,50,20)

# Calling method of the class 'student'
                                Copy Code