Riju21

36_inheritence_2

May 12th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. # inheritence
  2. # -----------
  3.  
  4. class Student():
  5.     def information(self, institution,result):
  6.         self.institution = institution
  7.         self.result = result
  8.         return ('university: {} and cgpa: {} '.format(self.institution, self.result))
  9.  
  10. class Access(Student):
  11.     def additionalInfo(self, mail):
  12.         self.email = mail
  13.         return ('email: {} '.format(self.email))
  14.  
  15.     def combine(self, gpa, cgpa):
  16.         self.termGpa = gpa
  17.         self.cgpa = cgpa
  18.         self.together = ('term gpa: {} , cgpa: {} '.format(self.termGpa, self.cgpa))
  19.         return ('result: {} '.format(self.together))
  20.  
  21.  
  22.  
  23. # obj
  24.  
  25. std_1 = Access()
  26. info = 'east west university-3.00'
  27. varsity, result = info.split('-')
  28. print(std_1.information(varsity, result))
  29. print(std_1.additionalInfo('[email protected]'))
  30. print(std_1.combine(3.42, 2.84))
Advertisement
Add Comment
Please, Sign In to add comment