list1.py 263 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
# basic list functionality
x = [1, 2, 3 * 4]
print(x)
x[0] = 4
print(x)
x[1] += -4
print(x)
x.append(5)
print(x)
f = x.append
f(4)
print(x)
13
14
15

x.extend([100, 200])
print(x)
16
17
x.extend(range(3))
print(x)
18
19
20

x += [2, 1]
print(x)
Paul Sokolovsky's avatar
Paul Sokolovsky committed
21
22
23
24

print(x[1:])
print(x[:-1])
print(x[2:3])