Wednesday, July 8, 2015

Using Lists as Queues

queue = ["Eric", "John", "Michael"] queue.append("Terry") # Terry arrives queue.append("Graham") # Graham arrives print queue s=queue.pop(0) print s s=queue.pop(0) print s print queue [deleting elements from list] a = [-1, 1, 66.6, 333, 333, 1234.5] del a[0] print a del a[2:4] print a