Python OOP Revision Notes
Python OOP Revision Notes
s1 = student("gaurav", 97)
print(s1.name)
print(s1.marks)
s2 = student("aryan", 99)
print(s2.name)
print(s2.marks, s2.college_name, student.college_name)
# Class: Car
class car:
def __init__(self, color, brand, drive):
print("about car")
self.color = color
self.brand = brand
self.drive = drive
def get_avg(self):
total = 0
count = 0
for value in self.subject:
total = total + value
count = count + 1
return total / count
s1 = Students("harris", 86, 78, 76)
print("hi", s1.name, ", avg score:", s1.get_avg())
def get_pass(self):
print(self.__account_pass)
def __hello(self):
print("hi, user")
def welcome(self):
self.__hello()
p1 = Person()
p1.welcome()