[Python] python[Python] python
🎆
Happy New Year
Week 1, 2026
def fireworks(n):
if n % 2 == 0 or n < 1:
raise ValueError("n must be a positive odd number")
mid = n // 2
#Top half
for i in range(mid):
spaces_left = mid - i
spaces_mid = i * 2 - 1
if i == 0:
print(" " * spaces_left + "|")
else:
print(
" " * spaces_left +
"\\" +
" " * spaces_mid +
"|" +
" " * spaces_mid +
"/"
)
#Middle line
print("-" * n)
#Bottom half (mirror)
for i in reversed(range(mid)):
spaces_left = mid - i
spaces_mid = i * 2 - 1
if i == 0:
print(" " * spaces_left + "|")
else:
print(
" " * spaces_left +
"/" +
" " * spaces_mid +
"|" +
" " * spaces_mid +
"\\"
)
# Call for fireworks(99)
fireworks(99)