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.
28 lines
349 B
28 lines
349 B
x = list(range(2))
|
|
|
|
l = list(x)
|
|
l[0:0] = [10]
|
|
print(l)
|
|
l = list(x)
|
|
l[:0] = [10, 20]
|
|
print(l)
|
|
l = list(x)
|
|
l[0:0] = [10, 20, 30, 40]
|
|
print(l)
|
|
|
|
l = list(x)
|
|
l[1:1] = [10, 20, 30, 40]
|
|
print(l)
|
|
|
|
l = list(x)
|
|
l[2:] = [10, 20, 30, 40]
|
|
print(l)
|
|
|
|
# Weird cases
|
|
l = list(x)
|
|
l[1:0] = [10, 20, 30, 40]
|
|
print(l)
|
|
|
|
l = list(x)
|
|
l[100:100] = [10, 20, 30, 40]
|
|
print(l)
|
|
|