i was trying to solve security code for the code coach but it gives me error in (if i > 0 and i <= length-1:)
but it gives me error in (if i > 0 and i <= length-1:) if floor TxGx$ floor_map = input("Enter the floor map ") floor_map = [floor_map.replace("x", "")] #print(floor_map) length = len(floor_map[0]) i = 0 p = "" while i in range(length): a = floor_map[0][i] if a == "$" : if i > 0 and i <= length-1: if floor_map[0][i-1] == "T" or floor_map[0][i+1] == "T" : p = "ALARM" i = length else: p = "" elif i == 0 : if floor_map[0][i+1] == "T" : p = "ALARM" i = length else: p = "" elif i == length : if floor_map[0][i-1] == "T" : p = "ALARM" i = length else: p = "" i += 1 if p != "ALARM": p = "nothing" print(p) Ajith