Solutions will be available when this assignment is resolved, or after a few failing attempts.
Create ASCII Box
Write a function
create_box that takes three inputs:
width (columns), and a character
char and creates a
width box using the character
For this exercise, it's recommended to use a nested for-loop. There are other ways of solving it (which might be a good starting point), but try reaching the nested for-loop solution.
>>> create_box(3, 4, '*') '**** **** ****' >>> create_box(2, 2, '@') '@@ @@'
IMPORTANT: You need to
return your box, not just print it.
test a 1x1 box - Run Test
box_1x1_expected = """ @ """.lstrip() def test_a_1x1_box(): assert create_box(1, 1, '@') == box_1x1_expected
test a 5x8 box - Run Test
box_5x8_expected = """ xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx """.lstrip() def test_a_5x8_box(): assert create_box(5, 8, 'x') == box_5x8_expected
test a 3x4 box - Run Test
box_3x4_expected = """ **** **** **** """.lstrip() def test_a_3x4_box(): assert create_box(3, 4, '*') == box_3x4_expected