Hi I would like create some code which will print a box that looks like this
+ -- + -- + -- + -- + -- +
| | | | | |
+ -- + -- + -- + -- + -- +
The code should use a loop to print a row of boxes using for i in range(5)(There should be no use of IF statement to solve this problem) by using one box only as shown below
+ -- +
| |
+ -- +
I have attempted to use the code below but not producing the output required. Please help
for i in range(5):
print("+--+\n| |\n+--+", end=" ")
printa single box five times--not only will you repeat "walls" that way, but if each box contains newlines, there's no way to "stack" them horizontally. You'll need to do the loop first, create the three lines you need to print, and then print them out once they're complete.