def print_alphabet_pyramid(rows):
    ascii_value = 65  # ASCII value of 'A'
    for i in range(1, rows + 1):
        for j in range(1, rows - i + 1):
            print(" ", end="")
        for k in range(1, 2 * i):
            print(chr(ascii_value), end="")
            if k < i:
                ascii_value += 1
            else:
                ascii_value -= 1
        print()

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

Embed on website

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