forked from Sbiswas001/Basic-python-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicPatternPrinting.py
More file actions
112 lines (99 loc) · 1.5 KB
/
BasicPatternPrinting.py
File metadata and controls
112 lines (99 loc) · 1.5 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#Basic Pattern Printing in Python (with while loop)
#1.Pointing at top-right
print("Pointing at top-right")
i=1
while(i<=5):
j=1
while(j<=5):
if(i<=j):
print('*',end=' ')
else:
print(end=' ')
j=j+ 1
print()
i=i+1
print()
print("="*50 +"\n")
#2.Pointing at bottom-left
print("Pointing at bottom-left")
i=1
while(i<=5):
j=1
while(j<=5):
if(i>=j):
print('*',end=' ')
else:
print(end=' ')
j=j+ 1
print()
i=i+1
print("\n")
print("="*50 +"\n"*2)
#3.Pointing at bottom-right
print("Pointing at bottom-right")
i=1
while(i<=5):
j=1
while(j<=5):
if(i+j>=6):
print('*',end=' ')
else:
print(end=' ')
j=j+ 1
print()
i=i+1
print("\n")
print("="*50 +"\n"*2)
#4.Pointing at top-left
print("Pointing at top-left")
i=1
while(i<=5):
j=1
while(j<=5):
if(i+j<=6):
print('*',end=' ')
else:
print(end=' ')
j=j+ 1
print()
i=i+1
print("\n")
print("="*50 +"\n"*2)
#Combined pattern
print("Combined pattern")
i= 1
while(i<=5):
j=1
while(j<=5):
if(i<=j):
print('*',end=' ')
else:
print(end=' ')
j+= 1
k=1
while(k<=5):
if(i+k>=6):
print('*',end=' ')
else:
print(end=' ')
k+= 1
print()
i+= 1
i= 1
while(i<=5):
j=1
while(j<=5):
if(i+j<=6):
print('*',end=' ')
else:
print(end=' ')
j+= 1
k=1
while(k<=5):
if(i>=k):
print('*',end=' ')
else:
print(end=' ')
k+= 1
print()
i+= 1