You are on page 1of 2

WEEK-2

1.Program to Print diamond star pattern

CODE:

def diamondStar(rows):

k1=1 k2=rows-1

for i in range(0,rows):

for j in range(0,rows):

if j>=k2:

print(“* “,end=” “)

else:

print(” “,end=” “)

k2-=1 print()

for i in range(0,rows):

for j in range(0,rows):

if j>=k1:

print(“* “,end=” “)

else:

k1+=1

print()

n=int(input(“Enter the number of Rows : “))

diamondStar(n)

output:
WEEK-2

2.

You might also like