I have made a dictionary and I put the keys of the dict in a list. My list contains elements like this:
s = [((5, 4), 'South', 1), ((4, 5), 'West', 1)]
I made a dict from this:
child = dict((t[0], t[1]) for t in s)
keys = child.keys()
print keys
The output is : [(4, 5), (5, 4)]
Now I need to put (4,5) and (5,4) into stack. What should I do?
I tried, but when I do pop from the stack it is giving me the 2 elements together.
like stack.pop() - output is : [(4, 5), (5, 4)]
. I want to pop one by one... (4,5) and then (5,4)