Python Programs to print pattern Number, Pyramid, Star, Diamond and Letter Pattern
top of page

Python Programs to print pattern Number, Pyramid, Star, Diamond and Letter Pattern

Updated: Nov 7, 2020


Write a python program for given Numbers Pattern using a for loop

1

2 2

3 3 3

4 4 4 4

5 5 5 5 5


Program:

for num in range(6):

for i in range(num):

print(num, end=" ")

print(" ")

Write Python Program for Half pyramid pattern with numbers

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5


Program:

for i in range(1, 6):

for column in range(1, i+1):

print(column, end=' ')

print("")

Write Python Program for Half pyramid pattern with Star (*)

*

* *

* * *

* * * *

* * * * *

Program:

space = 1

for i in range(0, 5):

for j in range(0, space):

print("* ", end="")

space = space + 1

print()

Python Program for Downward Half-Pyramid Pattern with Star (*)


* * * * *

* * * *

* * *

* *

*

Program:

space = 5

for i in range(0, 5):

for j in range(0, space):

print("* ", end="")

space = space - 1

print()

Write Python Program to print following pattern?

* * * * * * * * * * * * * * * * * * * * * * * * *

Program

space = 1

for i in range(0, 5):

for j in range(0, space):

print("* ", end="")

space = space + 2

print()

Write Python Program to print following pattern

* * * * * * * * * * * * * * * * * * * * * * * * *

Program:

space = 9

for i in range(0, 5):

for j in range(0, space):

print("* ", end="")

space = space - 2

print()

Write Python Program to Print Right start Pattern with Star (*)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Program:


space = 1

for i in range(0, 5):

for j in range(0, space):

print("* ", end="")

space = space + 1

print()

for i in range(0, 6):

for j in range(0, space):

print("* ", end="")

space = space - 1

print()


Python Program to print Downward star Pattern

* * * * * *

* * * * *

* * * *

* * *

* *

*

Program:

rows = 5

k = 2 * rows - 2

for i in range(rows, -1, -1):

for j in range(k, 0, -1):

print(end=" ")

k = k + 1

for j in range(0, i + 1):

print("*", end=" ")

print("")

Python Program to print following pattern

A BB CCC DDDD EEEEE

Program:

for i in range (65,70):

for j in range(65,i+1):

print(chr(i),end="")

print()

Python Program to print following pattern

A BC CDE DEFG EFGHI

Program:

for i in range (65,70):

for j in range(65,i+1):

print(chr(i),end="")

i=i+1

print()



339 views0 comments

Recent Posts

See All

Python program to calculate the factorial of a number

Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. This program is most for O Level Practical Exam so read it care

NumPy program to find the most frequent value in the list.

This program is most for O Level Practical Exam so read it carefully. Program: import numpy as np x = np.array([1,2,3,4,5,7,2,1,1,1,8,9,1]) print(x) print("most frequent value in the list:") print(np.

bottom of page