Python Program Print Hollow Heart of Stars

By | June 13, 2023

Python Program Print Hollow Heart of Stars – This is a Python program that will print a Hollow Heart of stars.

Hollow heart of stars Python program

Hollow heart of stars Python program

 

Source Code

n = 6

for row in range(n):
    for col in range(n+1):
        if (row == 0 and col % 3 != 0) or (row == 1 and col % 3 == 0) or (row - col == 2) or (row + col == 8):
            print("*", end="")
        else:
            print(" ", end="")
    print()

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *