The following code shows a Python Program to Create a Class.
# Define class Student with appropriate members
class Student:
def __init__(self, sname, course, location, marks1, marks2, marks3):
self.sname=sname
self.course=course
self.location=location
self.marks1=marks1
self.marks2=marks2
self.marks3=marks3
def getStudentDetails(self):
print("Student Name: "+self.sname)
print("Student Location: "+self.location)
print("Course: "+self.course)
def getTotalAndPercentage(self):
total=self.marks1+self.marks2+self.marks3
percentage=round((total/300)*100, 2)
print("Total Marks Obtained: "+str(total))
print("Percentage Obtained: "+str(percentage)+"%")
# Creating an object of the Student class
sob=Student("Ishaan", "Law", "Rampur Sargha", 78, 34, 82)
print("Student Details...")
sob.getStudentDetails()
print("Total and Percentage...")
sob.getTotalAndPercentage()
Output
Further Reading
Deep Learning Methods for Object Detection