summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/list_pop.py
blob: 87ed456f851743f2a528ecc707791baa86f4e9fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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)