7A . #calculator.py class number: multiplier=3 def __init__(self,x,y): self.x=x self.y=y def add(self): return self.x+self.y def multiply(self,a): return self.multiplier*a def subtract(b,c): return b-c T=number(2,4) print(T.add()) print(T.multiply(2)) print(number.subtract(4,2)) 7B.design the class that stores the info of students and display the same class student: def __init__(self,name,roll_no,address): self.name=name self.roll_no=roll_no self.address=address s=student("Bhavesh",406,"malad") print(s.name) print(s.roll_no) print(s.address) 7C.create a module student_details with functions display_name, marks_total & create new file that imports the module and display the functions. #student_details.py def display_name(Name): print("student Name:",Name) return def marks_total(p,c,m): print("Total marks obtained by student:",p+c+m) ret...
Comments
Post a Comment