You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
347 B
17 lines
347 B
# 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")
|
|
|
|
# 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)
|
|
|