Program to Print Pattern in Python

Today, we are going to discuss two Program to Print the Pattern in Python language. The python program to print number pattern and star pattern with source code will be discussed. This basic python program is very useful for beginners, CBSE Class 11,12 Computer Science and Project Practical file.

i)Number pattern -This pattern starts with 1 and then in next line 12 and then in next line 123 similarly it goes to 12345.


ii)Star pattern– This pattern starts with ***** and then in next line **** and then in next line *** similarly it goes to *.


WAP to Print Pattern using loop

In a Nested loop setting first the first loop (above loop) is called first time if it matches the conditions then the next whole loop upto last iterations iterates is calculated and shows the result. Here for all loop iterations are taken for loop under for 1 loop iteration of the above loop.
# is used for commenting where we use the # the whole line changes to comment

Python Source Code for the pattern program

pattern code in python

for i in range(1,6): #for loop in the range from 1 to 6 means 5 iteration
for j in range(1,i+1): #for loop from 1 to i+1
print(j,end=””) # print the number j which increases with each iteration
print() # It is used to get to new line

Output of the Program to Print Pattern in Python-

pattern code in python

Download the source code from here- click here

pattern code in python

for i in range(5,0,-1): #for loop initializing from i=5 to zero with decrease of -1 i with iteration
for j in range(i): #this loop j starts from 1 and goes to i every time the above loop changes 1 iteration
print(‘*’,end=””)#It print * with every iteration of j
print() #takes to a new line

Output of Program to Print Pattern in Python-

pattern code in python

Download the source code from here- click here

Today we learn the two basic python program. Keep on going . Thanks for visit.

for more program – click here

Hello World Program in Python

Input a welcome message and display it in Python

Display the larger / smaller number in Python.

Greatest of Three Numbers in Python using Nested if

Patterns using nested loop in Python

Program to Print Pattern in Python

Program to input the value of x and n and sum of series in Python

Python Program for Armstrong, Prefect Number, Palindrome

Program of Prime number by recursion in python

Prime Number Program in Python

Write a Program to Print Fibonacci Series in Python

LCM and GCD program in Python

Python program to count number of vowels in a string

Whether a String is Palindrome or not in Python

Bubble Sort Program in Python

Linear search in python using list

Program to read a text file in python

Python program to read a file line by line

Program to Count Vowels and Consonants in Python

Stack Program in Python

Queue Program in Python

Python Leap Year Program for Beginners

Python Program to Print Series and Addition

Binary Search Program in Python

Program to find sum of digits in python

Sum of numbers divisible by 3 and 5 in python