0
485views
Write a python program to print star in a Rectangular pattern
1 Answer
written 2.5 years ago by |
Explanation:-
Code:-
r=int(input("No of Rows in rectangle "))
c=int(input("No of Columns in rectangle "))
#Iterate over the rows
for i in range(r):
#Iterate over the columns
for j in range(c):
#print star if row no is 0 or no of rows-1
#print star if column no is 0 or no of column-1
if(i==0 or i==(r-1) or
j==0 or j==(c-1)):
print("*",end=" ")
#else print space
else:
print(" ",end=" ")
print()
Output:-