# Title: Diamond pattern
# Heading: Python Program to Print a Diamond Pattern
# Level: beginner
# Tags: diamond pattern, star pattern, pyramid, loops
# About: Prints a diamond of stars: the rows of a pyramid going down to the widest one, then the same rows again in reverse.

def diamond(n):
    """Print a diamond of stars, 2 * n - 1 rows tall."""
    # Rows 1 to n of a pyramid, then rows n - 1 back down to 1
    rows = list(range(1, n + 1)) + list(range(n - 1, 0, -1))
    for row in rows:
        spaces = n - row
        stars = 2 * row - 1
        print(" " * spaces + "*" * stars)


diamond(5)
