# Patterns using nested loop in Python

Write a Program (WAP) to Generate the Patterns using nested loop in Python. This python projects is useful for beginners and CBSE KV School Class 11 and Class 12 students computer science practical file and NIELIT O Level Programming and Problem Solving through Python (Module M3-R5).

#### Objective- Generate the following Patterns using nested loop in Python

We will write three python program to generate the Pattern 1, Pattern 2 and Pattern-3.

## Pattern -1

### Screenshot of source code

Explanation of source code

#Function to demonstrate printing pattern
def pypart(n):
#outer loop to handle number of rows
#n in this case
for i in range(0, n):
#inner loop to handle number of columns
#values changing acc. to outer loop
for j in range(0, i+1):
#printing stars
print(“* “,end=””)

ending line after each row
print(“\r”)

n = 5
pypart(n)

## Pattern 2

### Screenshot of source code

Source code
#Function to demonstrate printing pattern
def pypart(n):
# outer loop to handle number of rows
# n in this case
for i in range(n+1,1,-1):
y=i
t=0
#inner loop to handle number of columns
# values changing acc. to outer loop
for j in range(2,y+1,1):
t=t+1
#printing pattern
print(t,end=””)
# ending line after each row
print(“\r”)

n=int(input(“Enter the n.o where patterns begin”))

pypart(n)

## Pattern 3

### Screenshot of source code

Source code

for i in range(1,6):
for j in range(65,65+i):
a = chr(j)
print(a, end=” “)
print(“\r”)

## Output Patterns

We have successfully tested the Python Program for Patterns using nested loop.

For more Program for beginners and KV CBSE School Class 11 and Class 12 students computer science practical file and NIELIT O Level Programming and Problem Solving through Python (Module M3-R5).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