-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern_printing.py
51 lines (41 loc) · 1.11 KB
/
pattern_printing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class pattern:
def __init__(self,name):
self.name=name
pass
def rect(self,length, breath):
self.length=length
self.breath=breath
i,j=0,0
while i<length :
while j<breath :
print("*",end='')
j+=1
print("")
i+=1
j=0
def rect1(self,length,breath):
self.length=length
self.breath=breath
for i in range(length):
for i in range(breath):
print("*",end='')
print("")
def triangle(self,height,base):
self.height=height
self.base=base
i,j,k=0,0,0
while k<height:
while int(j/2)<base:
while i<j:
print("*",end='')
i=i+1
j=j+2
i=0
print("")
k=k+1
print('')
if __name__ == '__main__':
p1=pattern('design1')
p1.rect1(4,8)
p1.triangle(4,8)
pattern(1).rect(6,10)