Today, We will cover the following Python pattern programs:
Section A : Pattern 1:
Programs :
Section B : Pattern 1:
Section D : Pattern 1:
Programs :
Please do comment and share.
Thank You.
- Number Pattern
- Triangle Pattern with Number
- Star (*) or Asterisk Pattern
- Pyramid pattern
- Inverted pyramid pattern
- Half pyramid pattern
- Diamond Shaped Pattern
- Characters or Alphabets Pattern
- Square pattern
SECTION : A
Section A : Pattern 1:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Programs :
rows = int(input("Enter the number of rows "))
for row in range(1, rows+1):
for column in range(1, row + 1):
print(row, end=' ')
print("")
Section A : Pattern 2:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Programs :
Programs :
rows = int(input("Enter the number of rows "))
for row in range(1, rows+1):
for column in range(1, row + 1):
print(column, end=' ')
print("")
Section A : Pattern 3:
1
1 1
1 1 1
1 1 1 1
1 1 1 1 1
Programs :
Programs :
rows = int(input("Enter the number of rows "))
for row in range(1, rows+1):
for column in range(1, row + 1):
print("1", end=' ')
print("")
SECTION : B
Section B : Pattern 1:
5 5 5 5 5
5 5 5 5
5 5 5
5 5
5
Programs :
Programs :
rows = int(input("Enter number of rows "))
num = rows
for i in range(rows, 0, -1):
for j in range(0, i):
print(num, end=' ')
print("\r")
Section B : Pattern 2:
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5
Programs :
rows = int(input("enter number of rows "))
b = 0
for i in range(rows, 0, -1):
b += 1
for j in range(1, i + 1):
print(b, end=' ')
print('\r')
SECTION : C
Section C : Pattern 1:
1
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Programs :
Programs :
rows = int(input("Enter the number of rows ")) + 1
for row in range(1, rows):
num = 1
for j in range(rows, 0, -1):
if j > row:
print(" ", end=' ')
else:
print(num, end=' ')
num += 1
print("")
SECTION : D
Section D : Pattern 1:
*
* *
* * *
* * * *
* * * * *
Programs :
* *
* * *
* * * *
* * * * *
Programs :
rows = int(input("Enter the size of pattern ")) k = 2 * rows - 2 for i in range(0, rows): for j in range(0, k): print(end=" ") k = k - 2 for j in range(0, i + 1): print("* ", end="") print("")
SECTION : E
SECTION : F
Section F : Pattern 1:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
Programs :
rows = int(input("Enter max star to be display on single line "))
for i in range(0, rows):
for j in range(0, i + 1):
print("*", end=' ')
print("\r")
for i in range(rows, 0, -1):
for j in range(0, i - 1):
print("*", end=' ')
print("\r")
Thank you very much for reading carefully, if you have any other questions, you can share it with us through comments, if this information was important to you, please let us know through comments.
Please do comment and share.
Thank You.
No comments:
Post a Comment