Nov-18-2022, 11:19 AM
(Nov-17-2022, 08:59 PM)Yoriz Wrote: I have added a print statement that shows what is happening in your if statement and that it is alwaysFalse
def verify_seating_arranngment(cinema): line_1 = cinema[0] line_2 = cinema[1] line_3 = cinema[2] for i in line_1: print(f"{i} == 1 = {i ==1} and {i+1} == 1 = {i+1== 1} = {i ==1 and i+1== 1}") if i ==1 and i+1== 1: return False print(verify_seating_arranngment([ [0, 0, 2, 2, 0, 1, 1], [1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0] ]))
Output:0 == 1 = False and 1 == 1 = True = False 0 == 1 = False and 1 == 1 = True = False 2 == 1 = False and 3 == 1 = False = False 2 == 1 = False and 3 == 1 = False = False 0 == 1 = False and 1 == 1 = True = False 1 == 1 = True and 2 == 1 = False = False 1 == 1 = True and 2 == 1 = False = False None
ok got it, thank you,What do you think is the best way to do it?