Diamond print with * in python
print("Diamond printing")
num = int(input("Enter num how many num you want : "))
for i in range(num,0,-1):
for j in range(i,0,-1):
print("*", end=" ")
for j in range(2*(num-i)):
print(" ",end=" ")
for j in range(i,0,-1):
print("*", end=" ")
print()
for i in range(num):
for j in range(i+1):
print("*", end=" ")
for j in range(2*(num-i-1)):
print(" ",end=" ")
for j in range(i+1):
print("*", end=" ")
print()
Comments
Post a Comment