Problem 5, Part 1¶
Draw the following pattern:
**..**..**..
..**..**..**
**..**..**..
..**..**..**
**..**..**..
..**..**..**
You are given the size of the image (as width).
Data:
Express every line of the pattern |
Functions:
|
Draw the pattern with the size given as |
- ALLOWED_CHARS = re.compile('[.*]+')¶
Express every line of the pattern
- draw(width: int) Lines [source]¶
Draw the pattern with the size given as
width
and return the text lines.- Requires
width % 4 == 0
width > 0
- Ensures
len(result) == width / 2
all(len(line) == width for line in result)
result[0].endswith('.')
result[0].startswith('*')
result[-1].endswith('*')
result[-1].startswith('.')
all( ALLOWED_CHARS.fullmatch(line) for line in result )