Skip to content

Commit 11e3097

Browse files
committed
updated
1 parent fb5d9fc commit 11e3097

31 files changed

+159
-0
lines changed

Merge/Motivational.pdf

162 KB
Binary file not shown.

Merge/The Last Train Home.pdf

40.7 KB
Binary file not shown.

Merge/Train.pdf

24 KB
Binary file not shown.

cluster/1.png

57.1 KB
Loading

cluster/10.png

563 KB
Loading

cluster/2.png

1 MB
Loading

cluster/3.png

1.7 MB
Loading

cluster/4.png

1.92 KB
Loading

cluster/5.png

17.6 KB
Loading

cluster/6.png

1.03 MB
Loading

cluster/7.png

814 KB
Loading

cluster/8.png

977 KB
Loading

cluster/9.png

904 KB
Loading

cluster/about-me.jpg

80 KB
Loading

cluster/bg_1 (2).jpg

60.7 KB
Loading

cluster/bg_1.jpg

1.31 MB
Loading

cluster/cluster.txt

Whitespace-only changes.
Loading

cluster/proj_2.jpg

312 KB
Loading

cluster/proj_3.jpg

859 KB
Loading

cluster/proj_4.jpg

141 KB
Loading

cluster/proj_5.jpg

150 KB
Loading

day47(class methods).py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Employee:
2+
company = "Apple"
3+
def show(self):
4+
print(f"The name is {self.name} and company is {self.company}")
5+
6+
@classmethod
7+
def changeCompany(cls, newCompany):
8+
cls.company = newCompany
9+
10+
11+
e1 = Employee()
12+
e1.name = "Vishal"
13+
e1.show()
14+
e1.changeCompany("Tesla")
15+
e1.show()
16+
print(Employee.company)

day48(CM as Constr).py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Class method ko as a constructor kasie use kr skte h
2+
class Employee:
3+
def __init__(self,name,salary):
4+
self.name=name
5+
self.salary=salary
6+
@classmethod
7+
def fromStr(cls,string):
8+
return cls(string.split("-")[0],string.split("-")[1])
9+
e=Employee("Rohit",50000)
10+
print(e.name)
11+
print(e.salary)
12+
# if agar data string ke form me diya hoga then
13+
string="Vishal-12000"
14+
# we use split(" ")[] to get
15+
# e2=Employee(string.split("-")[0],string.split("-")[1])
16+
# print(e2.name)
17+
# print(e2.salary)
18+
e2=Employee.fromStr(string)
19+
print(e2.name)
20+
print(e2.salary)

day49(dir,__dict__,help).py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# inbuilt functionss
2+
3+
#dir
4+
x=[1,2,3]
5+
x=(1,2,3)
6+
print(dir(x)) #ye returns all the attributes and methods
7+
print(x.__add__)
8+
9+
10+
#__dict__
11+
class Person:
12+
def __init__(self,name,age):
13+
self.name=name
14+
self.salary=age
15+
p=Person("john",35)
16+
print(p.__dict__)
17+
18+
#help
19+
print(help(Person))

day50(Super).py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#parent class ko refer krrta h
2+
# child to parent classs
3+
class Employee:
4+
def __init__(self, name, id):
5+
self.name = name
6+
self.id = id
7+
8+
class Programmer(Employee):
9+
def __init__(self, name, id, lang):
10+
# self.name = name
11+
# self.id = id
12+
super().__init__( name, id)
13+
self.lang = lang
14+
15+
rohan = Employee("Rohan Das", "420")
16+
vishal = Programmer("vishal", "2345", "Python")
17+
print(vishal.name)
18+
print(vishal.id)
19+
print(vishal.lang)

day51(Magic,Dunder).py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# purpose ki ye special kaam krte h (Random Methods)
2+
class Employee:
3+
def __init__(self,name):
4+
self.name= name
5+
6+
# name="Vishal"
7+
def __len__(self):
8+
i=0
9+
# return len(self.name)
10+
for c in self.name:
11+
i=i+1
12+
return i
13+
def __str__(self):
14+
return f" the name of the employee is {self.name} str"
15+
def __repr__(self):
16+
return f" Emplopyee'{self.name} '"
17+
def __call__(self):
18+
print("Hey i m good")
19+
20+
21+
e=Employee("vishal")
22+
# print(e.name)
23+
# print(len(e)) #hmlog __len__ na kr ke direct len se call kie this is magic
24+
# print(e)
25+
print(str(e))
26+
print(repr(e))
27+
e()

day52(Overriding).py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# child class ke andar jo parent class ka method
2+
# aaya usmo change krna
3+
4+
class Shape:
5+
def __init__(self,x,y):
6+
self.x= x
7+
self.y=y
8+
9+
def area(self):
10+
return self.x*self.y
11+
12+
class Circle(Shape):
13+
def __init__(self, radius):
14+
self.radius=radius
15+
super().__init__(radius,radius)
16+
17+
def area(self):
18+
return 3.14*super().area()
19+
# sq=Shape(5,5)
20+
# print(sq.area())
21+
# rec=Shape(5,5)
22+
# print(rec.area())
23+
c=Circle(5)
24+
print(c.area())

ex-8(Clear the cutter).py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
# os.rename("cluster/bout.txt","cluster/cluster.txt")
3+
# files = os.listdir("cluster")
4+
5+
files = os.listdir("cluster")
6+
i = 1
7+
for file in files:
8+
if file.endswith(".png"):
9+
print(file)
10+
os.rename(f"cluster/{file}", f"cluster/{i}.png")
11+
i = i + 1

ex-9(mergepdf).py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from PyPDF2 import PdfWriter
2+
import os
3+
pdf_directory = "Merge"
4+
merger = PdfWriter()
5+
# files=[file for file in os.listdir("Merge") if file.endswith(".pdf")]
6+
files = [os.path.join(pdf_directory, file) for file in os.listdir(pdf_directory) if file.endswith(".pdf")]
7+
for pdf in files:
8+
merger.append(pdf)
9+
output_file = "merged-pdf.pdf"
10+
merger.write(output_file)
11+
# merger.write("merged-pdf.pdf")
12+
merger.close()
13+
# import os
14+
# # os.rename("cluster/bout.txt","cluster/cluster.txt")
15+
# # files = os.listdir("cluster")
16+
17+
# files = os.listdir("Merge")
18+
# i = 1
19+
# for file in files:
20+
# if file.endswith(".pdf"):
21+
# print(file)
22+
# os.rename(f"Merge/{file}", f"Merge/{i}.pdf")
23+
# i = i + 1

merged-pdf.pdf

227 KB
Binary file not shown.

0 commit comments

Comments
 (0)