class car:
attr1 = "sound"
attr2 = "light"
#sample method
def fun(self):
print("car",self.attr1)
print("car",self.attr2)
#drive
rodger = car();
print(rodger.attr1);
rodger.fun();
class jug:
attr1 = "yellow"
attr2 = "brown"
#sample method
def fun(self):
print("jug",self.attr1)
print("jug",self.attr2)
rodger = jug();
print(rodger.attr2);
rodger.fun();
class F:
def __init__(self,name1,name2):
self.name1 = name1
self.name2 = name2
def show(self):
print("hello my name is" +self.name1+"i live in"+self.name2)
obj = F("Anup","Palakkad")
obj.show()
To embed this project on your website, copy the following code and paste it into your website's HTML: