Write a python program to print patterns [AAA BBB CCC][A BB CCC][333 222 111][* ** *** ** *] -- EasyCoding45
Write a python program to print patterns
[AAABBB
CCC]
[A
BB
CCC]
[333
222
111]
[*
**
***
**
*]
In this tutorial we are going to learn how we can print above patterns using python.
Program :- (Write a python program to print patterns [AAA BBB CCC][A BB CCC][333 222 111][* ** *** ** *])
row =int(input("Enter The Number of Rows :"))
ch=65
#printing First Pattern
print("***First pattern*** ")
for i in range(row):
for j in range(row):
print(chr(ch),end=' ')
ch+=1
print()
#printing second pattern
print("***Second Pattern***")
ch1=65
j=0
for i in range(row):
for j in range(i+1):
print(chr(ch1), end=' ')
ch1 += 1
print()
#printing third pattern
print("***Third Pattern***")
temp=row
for i in range(row):
for j in range(row):
print(temp, end=' ')
temp-=1
print()
#printing Fourth pattern
print("***Fourth Pattern***")
for i in range(row):
for j in range(i+1):
print('*', end=' ')
print()
for i in range(row,0,-1):
for j in range(1,i,+1):
print('*',end=' ')
print()
Output :-
Please comment down if you have any doubt👇👇
Comments
Post a Comment