Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/classobj_1.cpython-310.pyc
Binary file not shown.
Empty file added classesandobjs/__init__.py
Empty file.
Binary file added classesandobjs/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions classesandobjs/classcollection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Mammal:
mmlist=[]
name="Human"
num_of_legs=4
feather=True
skilcolor=["Red","Green","Yellow","Pink","Black","White","Orange"]
def getproperties(self):
print(self.num_of_legs,self.feather,self.skilcolor)
def addtommlist(self,nm,nlegs,fethur,skinclr):
self.mmlist.append([nm,nlegs,fethur,skinclr])
def pringmmlist(self):
print(self.mmlist)


37 changes: 37 additions & 0 deletions classobj_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Animal:
name = "Animal"
print("I am a Animal Class !")
numlegs = 4
horn = True
run = "Runs"
Eats = "Grass"
Eat = ["Grass", "Meat"]

def getmyname(self,name):
print("My Name is : ", self.name)
print("And My New Name is : ", name)


class Dog(Animal):
name = "Doggy"
print("I am a Dog Class !")
Eats = "NoGrass"
eat = ["Meat", "Rice"]
horn = False

def getmyname(self, new_name):
print("My Name is : ", self.name, "And New name is", new_name)


animal = Animal
print(animal.Eat)
print(animal.horn)
mya = animal
print(mya.Eat)
dog = Dog()
print(dog.Eat)
print(dog.horn)
dog = Animal()
puppy = Dog()
dog.getmyname("TOMMYU")
puppy.getmyname('Rolo')
15 changes: 15 additions & 0 deletions classobj_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#from classobj_1 import Animal,Dog
from classesandobjs.classcollection import Mammal
'''
animal=Animal()
print(animal.Eat)
animal.getmyname("PomPom")
'''

mm=Mammal();
mm.getproperties()
mm.addtommlist("Whale",0,False,"['Blue','Black']")
mm.addtommlist("Human",2,False,"['Black','White','Brown']")
mm.pringmmlist()
mm.mmlist.pop()
mm.pringmmlist()