class Star:
    def __init__(self, n):
            self.n = n

    def print_star(self):
        for i in range(1, self.n + 1): 
            for j in range(self.n - i):
                print(" ", end="")
            for k in range(2 * i - 1): 
                print("*", end="")
            print()    

n = int(input())
s = Star(n)
s.print_star()

Embed on website

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