Ok this actually was a bit harder than I imagined when I realized that it was not a square. Truly weird.
def inline(text):
print(text, end='')
def pattern(width):
for x in range(width - 1):
for y in range(width):
if x == 0 or x == width - 2 or y == 0 or y == width - 1:
inline("#")
elif x < width // 2 and (x == y or x == width - y - 1):
inline("#")
elif x >= width // 2 and (y == x + 1 or y == width - x - 2):
inline("#")
else:
inline(" ")
print()
pattern(10)
View all comments
Show parent comment
10
u/ohaz 9h ago
Ok this actually was a bit harder than I imagined when I realized that it was not a square. Truly weird.