Question: Can anyone help me get the following code to print in a new line per for loop? def display(deposits, top, bottom, left, right): res =

Can anyone help me get the following code to print in a new line per for loop?

def display(deposits, top, bottom, left, right):

res = '' for row in range(top, bottom): for col in range(left, right): flag = 0 for (index, tuples) in enumerate(deposits): if (tuples[0] == row and tuples[1] == col): flag = 1 res += "X" break if(flag == 0): res += "-" return res

print(display(deposits, 0, 8, 0, 8))

----X------------------------X-X-------------X----X------------X

How do I get print(display(deposits, 0, 8, 0, 8)) to print in the following way below:

----X--- -------- -------- -----X-X -------- -----X-- --X----- -------X

I will make sure to reward those who provide answers! Thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!