For some reason I am getting the lists to always be equal, even though when printed, you can see that they are not always equal.
It is returning True when the previous_list = [1,0,0,0,0] and the current_list = [0,0,0,0,0]
There are many questions regarding comparing lists, but I have tried many different answers like the cmp(), but it returns 0 as well. So why does it say its the same but when printed, you can see they are different?
while True:
previous_status_list = current_status_list
print str(previous_status_list) + " PREVIOUS"
if door_status == 'closed' and status_for_loop == 'closed':
overall_status_list[0] = 0
else:
overall_status_list[0] = 1
if door_locked_status == False:
overall_status_list[1] = 0
else:
overall_status_list[1] = 1
if door_breached_status == False:
overall_status_list[2] = 0
else:
overall_status_list[2] = 1
if door_propped_status == False:
overall_status_list[3] = 0
else:
overall_status_list[3] = 1
if egress_status == False:
overall_status_list[4] = 0
else:
overall_status_list[4] = 1
current_status_list = overall_status_list
if current_status_list == previous_status_list:
print 'TRUE'
else:
print 'False'
print str(current_status_list) + " CURRENT"
sleeptime.sleep(3)