0% found this document useful (0 votes)
2 views2 pages

K-11211 Assignment 5

The document is an assignment from the Modern College of Engineering for a student named Anjali Kaluram Choudhary. It requires writing a Python program to create a specific pattern using nested for loops. The pattern consists of numbers and asterisks arranged in a 5x5 grid format.

Uploaded by

bhatrithik69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

K-11211 Assignment 5

The document is an assignment from the Modern College of Engineering for a student named Anjali Kaluram Choudhary. It requires writing a Python program to create a specific pattern using nested for loops. The pattern consists of numbers and asterisks arranged in a 5x5 grid format.

Uploaded by

bhatrithik69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Progressive Educa on Society's

Modern College of Engineering, Pune-05.

(An Autonomous Ins tute Affiliated to Savitribai Phule Pune University)

Department of F. Y. B.Tech

Assignment No: 5

RollNo: 11211

Name: ANJALI KALURAM CHOUDHARY

Class: FY B. Tech

Div: K

Batch: K-1

Title / Problem Statement:

Write a Python program to construct the following pattern, using a nested for loop

11*11
1***1
*****
1***1
11*11

Course Outcome: CO110.2: Make use of various data types, operations, conditions, loops.

Program:

n=5 for i in

range(n): for j in

range(n):

if(i==0 or i==n-1)and(j==0 or j==1 or j==n-1 or j==n-2):

print(1,end=" ")

elif j==2:
Progressive Educa on Society's
Modern College of Engineering, Pune-05.

(An Autonomous Ins tute Affiliated to Savitribai Phule Pune University)

Department of F. Y. B.Tech

print("*",end=" ")

elif i==2:

print("*",end=" ") elif (i==1 or i==n-

2)and(j==0 or j==n-1):

print(1,end=" ")

elif(i==1 or i==n-2):

print("*",end=" ")

else:

print("*",end="

") print() Output:

You might also like