KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What's the best way to iterate over a stack in Python? a = [1,2,3,4] while (len(a) > 0) print a.pop() # prints 4, 3, 2, 1 in sequence I couldn't find an isempty method, and checking the length each time seems wrong somehow.
Tags (comma-separated)
Save Edits
Cancel