test = [1,2,3]
queue_test = deque(a for a in test)
a=[1,3,2]
for b in a:
for list_queues in list(queue_test):
if b == list_queues:
queue_test.popleft()
print('done pop')
else:
print('Error')
break
print('a',queue_test)
I need to exit the loop once Error detected, so it does not need to go for another loop after Error but i dont know where to put the break statement. My current output is
done pop
Error
done pop
a deque([3])
My expected output is
done pop
Error
a deque([3,2])