This Python program reads an even number n from the user and prints a specific pattern made of asterisks.
The pattern consists of a horizontal line of three asterisks at the top and bottom, and a vertical column of single asterisks in between.
Although the prompt requests an even number, the sample shown uses n = 9, which is odd — so the program accepts any positive integer.
# Read input from user
n = int(input("Enter an even number: "))
# Print top border
print("***")
# Print vertical column
for _ in range(n):
print("*")
# Print bottom border
print("***")
***
*
*
*
*
*
*
*
*
*
***
- The program starts by printing three asterisks for the top border
- Then it prints n lines, each containing a single asterisk
- Finally, it prints three asterisks again for the bottom border
- The input is labeled “even” but the logic works for any positive integer