# Title: Pyramid pattern
# Heading: Python Program to Print a Pyramid Pattern
# Level: beginner
# Tags: pyramid pattern, star pattern, full pyramid, triangle, loops
# About: Prints a centred pyramid of stars: each row has one space less in front and two more stars than the row above.

def pyramid(n):
    """Print a pyramid of stars, n rows tall."""
    for row in range(1, n + 1):
        spaces = n - row
        stars = 2 * row - 1
        print(" " * spaces + "*" * stars)


pyramid(5)
