Answer to Question #271319 in Python for Rabby

Question #271319

Print right half Diamond pattern using for loop in python


1
Expert's answer
2021-11-25T07:05:06-0500
def diamond(N):
    for i in range(N):
        for j in range(0, i + 1):
            print("*", end="")
        print()

    for i in range(1, N):
        for j in range(i, N):
            print("*", end="")
        print()

diamond(5)




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