Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started