diff --git a/__pycache__/classobj_1.cpython-310.pyc b/__pycache__/classobj_1.cpython-310.pyc new file mode 100644 index 0000000..5775aa8 Binary files /dev/null and b/__pycache__/classobj_1.cpython-310.pyc differ diff --git a/classesandobjs/__init__.py b/classesandobjs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/classesandobjs/__pycache__/__init__.cpython-310.pyc b/classesandobjs/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..b922e6e Binary files /dev/null and b/classesandobjs/__pycache__/__init__.cpython-310.pyc differ diff --git a/classesandobjs/__pycache__/classcollection.cpython-310.pyc b/classesandobjs/__pycache__/classcollection.cpython-310.pyc new file mode 100644 index 0000000..de8ca8b Binary files /dev/null and b/classesandobjs/__pycache__/classcollection.cpython-310.pyc differ diff --git a/classesandobjs/classcollection.py b/classesandobjs/classcollection.py new file mode 100644 index 0000000..525e4dd --- /dev/null +++ b/classesandobjs/classcollection.py @@ -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) + + diff --git a/classobj_1.py b/classobj_1.py new file mode 100644 index 0000000..2b9de2c --- /dev/null +++ b/classobj_1.py @@ -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') diff --git a/classobj_2.py b/classobj_2.py new file mode 100644 index 0000000..80561ae --- /dev/null +++ b/classobj_2.py @@ -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() \ No newline at end of file diff --git a/conditionscomparisons.py b/conditionscomparisons.py new file mode 100644 index 0000000..34c2b76 --- /dev/null +++ b/conditionscomparisons.py @@ -0,0 +1,36 @@ +var1=10 +var2=23 +var3=10 +var4=34 +if(var1==var2): + print("Equal") + +if(var1==var4): + print("True") +elif(var4>var1): + print("Greater") +else: + print("I am out") + +if(var1<=var4): + print("Less") + if(var4>=var3): + print("Greater") + if(var1==var3): + print("Equal") + +value1=int(input("Please enter a number: ")) +if(value1%2==0): + print("Number Is Even") +else: + print("Numbe is Odd") + +alpha=input("Enter a Alphabet:") +if(alpha=='a' or alpha=='e' or alpha=='i' or alpha=='o' or alpha=='u'): + print("Alphabet",alpha,"is Vowel") +else: + print("Alphabet",alpha,"Is a Consonent") + + + +print diff --git a/factorial.py b/factorial.py new file mode 100644 index 0000000..99882ff --- /dev/null +++ b/factorial.py @@ -0,0 +1,13 @@ +fact=1 +number=int(input("Enter the Number for Factorial: ")) +for i in range(1,(number+1)): + fact=fact*i +print("Factorial of ",number,"Is",fact) + +fact=1 +i=1 +number=int(input("Enter the Number for Factorial: ")) +while(i<=number): + fact=fact*i + i=i+1 +print("Factorial of ",number,"Is",fact) diff --git a/loops.py b/loops.py new file mode 100644 index 0000000..5d3c507 --- /dev/null +++ b/loops.py @@ -0,0 +1,21 @@ +for i in range(2): + print("Hello") + print(i) +for i in range(1,4): + print("Hi") + print(i) +for i in range(1,5,2): + print("Huh") + print(i) +number=0 +for i in range(3): + number=number+i + print(number,i) +i=1 +while(i<=5): + print(i) + i=i+1 + +num4table=int(input("Enter Number for Table: ")) +for i in range(1,11): + print(num4table,"*",i,"=",num4table*i) \ No newline at end of file diff --git a/operators.py b/operators.py index 69bcf1d..9d7d008 100644 --- a/operators.py +++ b/operators.py @@ -8,3 +8,5 @@ print("Bodmas:",intval+floatval-intval/floatval*intval) print("Bodmas:",((intval+floatval)-(intval/floatval))*(intval*intval)) print("Bodmas:",((intval+floatval)-(intval/floatval))*(intval*intval)/floatval) + +