2014-01-03 17:53:18 -05:00
|
|
|
# list poppin'
|
|
|
|
a = [1, 2, 3]
|
|
|
|
print(a.pop())
|
|
|
|
print(a.pop())
|
|
|
|
print(a.pop())
|
|
|
|
try:
|
|
|
|
print(a.pop())
|
|
|
|
except IndexError:
|
|
|
|
print("IndexError raised")
|
|
|
|
else:
|
|
|
|
raise AssertionError("No IndexError raised")
|
2016-08-14 20:46:35 -04:00
|
|
|
|
|
|
|
# popping such that list storage shrinks (tests implementation detail of uPy)
|
|
|
|
l = list(range(20))
|
|
|
|
for i in range(len(l)):
|
|
|
|
l.pop()
|
|
|
|
print(l)
|