Python Push And Pop Algorithm In Stacks