Answer to Question #333458 in Python for Krishnaveniswargam

Question #333458

given an integer value N as input write a program to print a shaded diamond of 2 *N -1 rows using an asterisk characters

1
Expert's answer
2022-04-25T13:37:10-0400


n=int(input("Please input n:"))
num=2*n-1
for i in range(1, num+1):
  i = i - (num//2 +1)
  if i < 0:
    i = -i
  print(" " * i + "*" * (num - i*2) + " "*i)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS