Create a class "student" with attributes like id, name, semester, emailid, birthdate, city. a. getData() to take student information. b. setData() to display student information. Inherit class “Exam” with attributes like exam_id, exam_type, exam_subject, exam_marks and methods to generate report of particular student in proper format. - Pratik Ghelani

Pratik Ghelani

Breaking

Sunday, May 10, 2020

Create a class "student" with attributes like id, name, semester, emailid, birthdate, city. a. getData() to take student information. b. setData() to display student information. Inherit class “Exam” with attributes like exam_id, exam_type, exam_subject, exam_marks and methods to generate report of particular student in proper format.

Input:-

class student(object):
    id =0
    Name = ""
    semester = 0
    Email = ""
    Birthday = ""
    City = ""
    def set(self,id,name,semester,Email,Birthday,City):
        self.id=id
        self.Name=name
        self.semester=semester
        self.Email=Email
        self.Birthday=Birthday
        self.City=City
    def get(self):
        print()
        print("Student details:-")
        print("Id:-",self.id)
        print("Name:-",self.Name)
        print("Samester:-",self.semester)
        print("email id:-",self.Email)
        print("Birthday:-",self.Birthday)
        print("City:-",self.City)
class Exam (student):
    exam_id=0
    exam_type=""
    exam_subject=""
    exam_marks=0

    def set(self,exam_id,exam_type,exam_subject,exam_marks):
        self.exam_id=exam_id
        self.exam_type=exam_type
        self.exam_subject=exam_subject
        self.exam_marks=exam_marks
    def get(self):
        print()
        print("Exam details:-")
        print("exam id:-",self.exam_id)
        print("exam type:-",self.exam_type)
        print("exam subject:-",self.exam_subject)
        print("exam_marks:-",self.exam_marks)
a = student()
a.set(91,"Parth Shah",6,"parthrohit24@gmail.com","21/02/2000","Naroli")
a.get()

b = Exam()
b.set("1023","Univercity","Python","80")

b.get()


Output:-


No comments:

Post a Comment