In this article, I show you how to Print pattern in Python.
Today, We will cover the following Python pattern programs:
- 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
Numbers 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("")
Number 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("")
Number Pattern 2:
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
Numbers 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")
Numbers 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
Numbers 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
Numbers 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
Numbers Pattern 1:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
Programs :
Please do comment and share.
Thank You.
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
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