From ce81b61b788397852cc35a0dcb349369342afa66 Mon Sep 17 00:00:00 2001 From: Shashwat Shriparv Date: Tue, 18 Jan 2022 23:17:16 +0530 Subject: [PATCH 1/5] adding conditoin file --- conditionscomparisons.py | 28 ++++++++++++++++++++++++++++ operators.py | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 conditionscomparisons.py diff --git a/conditionscomparisons.py b/conditionscomparisons.py new file mode 100644 index 0000000..3a129f2 --- /dev/null +++ b/conditionscomparisons.py @@ -0,0 +1,28 @@ +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") + + 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) + + From 7bf6f09e111f483522eb4c9987fe1cff70fba3c1 Mon Sep 17 00:00:00 2001 From: Shashwat Shriparv Date: Wed, 19 Jan 2022 00:04:19 +0530 Subject: [PATCH 2/5] Adding Loop File --- conditionscomparisons.py | 8 ++++++++ loops.py | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 loops.py diff --git a/conditionscomparisons.py b/conditionscomparisons.py index 3a129f2..34c2b76 100644 --- a/conditionscomparisons.py +++ b/conditionscomparisons.py @@ -25,4 +25,12 @@ 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/loops.py b/loops.py new file mode 100644 index 0000000..ca12ef9 --- /dev/null +++ b/loops.py @@ -0,0 +1,17 @@ +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 \ No newline at end of file From edc8ca71ff6e89708fc10146eabfa3d40e5ba7d5 Mon Sep 17 00:00:00 2001 From: Shashwat Shriparv Date: Mon, 24 Jan 2022 22:31:26 +0530 Subject: [PATCH 3/5] adding loop.py file --- factorial.py | 13 +++++++++++++ loops.py | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 factorial.py 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 index ca12ef9..5d3c507 100644 --- a/loops.py +++ b/loops.py @@ -14,4 +14,8 @@ i=1 while(i<=5): print(i) - i=i+1 \ No newline at end of file + 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 From 867751312e05d9049983c49ea56976cfd8e078f1 Mon Sep 17 00:00:00 2001 From: Shashwat Date: Tue, 1 Feb 2022 23:20:49 +0530 Subject: [PATCH 4/5] Ading Class/Object file --- classobj.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 classobj.py diff --git a/classobj.py b/classobj.py new file mode 100644 index 0000000..074ccd5 --- /dev/null +++ b/classobj.py @@ -0,0 +1,40 @@ +class Animal: + name="Animal" + print("I am a Animal Class !") + numlegs=4 + horn=True + run="Runs" + Eats="Grass" + Eat=["Grass","Meat"] + def getmyname(self): + print("My Name is : ",self.name) + +class Dog(Animal): + name="Doggy" + print("I am a Dog Class !") + Eats="NoGrass" + eat=["Meat","Rice"] + horn=False + def getmyname(self): + print("My Name is : ",self.name) + 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() +puppy.getmyname() +puppy.getmyname('Rolo') \ No newline at end of file From a18930ff46498523d3dd7289d17786c9019d04b7 Mon Sep 17 00:00:00 2001 From: Shashwat Date: Wed, 2 Feb 2022 00:37:31 +0530 Subject: [PATCH 5/5] Changes to be committed: new file: __pycache__/classobj_1.cpython-310.pyc new file: classesandobjs/__init__.py new file: classesandobjs/__pycache__/__init__.cpython-310.pyc new file: classesandobjs/__pycache__/classcollection.cpython-310.pyc new file: classesandobjs/classcollection.py deleted: classobj.py new file: classobj_1.py new file: classobj_2.py --- __pycache__/classobj_1.cpython-310.pyc | Bin 0 -> 1208 bytes classesandobjs/__init__.py | 0 .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 158 bytes .../classcollection.cpython-310.pyc | Bin 0 -> 945 bytes classesandobjs/classcollection.py | 14 ++++++ classobj.py | 40 ------------------ classobj_1.py | 37 ++++++++++++++++ classobj_2.py | 15 +++++++ 8 files changed, 66 insertions(+), 40 deletions(-) create mode 100644 __pycache__/classobj_1.cpython-310.pyc create mode 100644 classesandobjs/__init__.py create mode 100644 classesandobjs/__pycache__/__init__.cpython-310.pyc create mode 100644 classesandobjs/__pycache__/classcollection.cpython-310.pyc create mode 100644 classesandobjs/classcollection.py delete mode 100644 classobj.py create mode 100644 classobj_1.py create mode 100644 classobj_2.py diff --git a/__pycache__/classobj_1.cpython-310.pyc b/__pycache__/classobj_1.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5775aa851ccb5d2eb0f2bcd1abfdc003abe1efdb GIT binary patch literal 1208 zcmZ`&OK%e~5VqIeN47~?O3MLpSdO_=AoYMMgs2Ks91<#84p@;^OKkGcK7x0nYNH+y z>5(4+$Nr_ga^fe@3(RIL|@yFQATz zB$8f&EG&VZB^h{3kp&Y}5n(B&tO;LGN{nS2%MuQF&N5CHM7ZF)H+Al$t|KOcc~80D z8j^p62E8az!8i{Ng8A-YDgz9u^R@7mRoPQL zPK%1CP}{L8o~!tycH#Ofq8qSX?~e}pr=utzokvCgL}x=CCCNA)_D{-Ul%)`vs6mnU z2lz4Bhe`N&Z(3H3p(>IRFU1+i@e7-@P3K$nr|;dQd!3ES3q!07!^#iCB$Klk?PeH$ znniJ)F)e8at`TlJOJX$yj7FJGE2d{@#a~86UNO*m18Pj?YYKbN6ckFn4ay^&dXz7J z9&K7CfBOVHfz zglnW0MqoTpul}RmhMb{&2aFZ%hHwreSQD-h;`t`hj2t6sK)uGJ9ZP$#RbHyj4bcB0 zgOJ?=$#KSZ=)46Tt~1ooO-Se#sx~T|4?~8&0~UY*xNl$un;WmXwiT67ikRrqlA)$1Cq?Jyg#O{SV-V UHrZg`kg7&7Li6Hthh(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o6u;!zv~?Be6K6 zJh3DupeR4RC^0uTGcP?Rpt2+*KMyF9m6}{q9Fv@rSX`W1oS2uApOjS`6Ca2KczG$)edBIF%ytrVE_OK`zLS! literal 0 HcmV?d00001 diff --git a/classesandobjs/__pycache__/classcollection.cpython-310.pyc b/classesandobjs/__pycache__/classcollection.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de8ca8bdd9686ce9485027a27a27c3d1e2654e9a GIT binary patch literal 945 zcmZuw&2H2%5VrHbe+8{j)mO-+4}dCE!J)mdR4fw0S}8KIH%aR_i=9=~YH!;I0WN4? z$yZK10-Tsh3f&4On$I(tWM;mZq?t^H1myJYC;vtX`Hs%M_~4v^+9|*p5k$~C(5=Ua z@a81-bGZLVJn&9I?FoP+j0(cMf-qlD76^}p!e>!IMDUfeScD?FBPBY=$W(wO;grC{Niky5khgH)=yX2C_JuUPm}@f?o#Wz|X+ zy)j%DG6!OR1#Qgp3e+9~v}8jrDX0hPZ+!|R=VV7`Y2d<@sdVc`dR=GDGE=g!E?!FB zmeRO^y{c5+sK)H53#?Sj9Wgk~U+3lX#k}OUyyorV!Zd{e8kH^<7dLI$Xt;AJ^VTkM z#jTZ=YtekXymuj?f?(C?Y?$@uLUw5Q2XM?Fh7E zdISdWBcJJpZoG}Z35wtg?YSCUa_YILu2p4Q7xC3fYLSL!00HLdnuQvm|;JaP3NAz}j-|SxapQRwLuGIrD`lW0iH)wEgW`d9);H>wH zjdwahX%%(A)>YlZeW%Ra5S>LXn(7ocNsng+*da0_OP x@C4y0!b2;ah2;%?X{g<=laPS+S3=?P#$FenrL;T$m%t?_eOoWOEI6Mj`3-*z)U5yj literal 0 HcmV?d00001 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.py b/classobj.py deleted file mode 100644 index 074ccd5..0000000 --- a/classobj.py +++ /dev/null @@ -1,40 +0,0 @@ -class Animal: - name="Animal" - print("I am a Animal Class !") - numlegs=4 - horn=True - run="Runs" - Eats="Grass" - Eat=["Grass","Meat"] - def getmyname(self): - print("My Name is : ",self.name) - -class Dog(Animal): - name="Doggy" - print("I am a Dog Class !") - Eats="NoGrass" - eat=["Meat","Rice"] - horn=False - def getmyname(self): - print("My Name is : ",self.name) - 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() -puppy.getmyname() -puppy.getmyname('Rolo') \ No newline at end of file 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