N = 5

for i in range(1, N+1, 2):
    spaces = (N - i) // 2
    print(" " * spaces + "*" * i)

for i in range(N-2, 0, -2):
    spaces = (N - i) // 2
    print(" " * spaces + "*" * i)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: