def print_star_pyramid(rows):
    for i in range(1, rows + 1):
        print(" " * (rows - i), end="")
        for j in range(1, 2 * i):
            print("*", end="")
        print()

# Example usage:
rows = int(input("Enter the number of rows for the star pyramid: "))
print_star_pyramid(rows)

Embed on website

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