array = [1, 2, 3, 4, 5, 6, 7]
array
Image by the author
array = [1, 2, 3, 4, 5, 6, 7]
print(array[0])
print(array[-1])
print(array[2:5])
Image by the author
array = [1, 2, 3, 4, 5, 6, 7]
print(array + [8, 9, 10, 11])
Image by the author
array = [1, 2, 4, 4, 5, 6, 7] # 4 instead of 3 on index 2
array[2] = 3
print(array)
Image by the author
array = [1, 2, 3, 4, 5, 6, 7]
array[2:5] = [5, 4, 3]
print(array)
array[2:5] = []
print(array)
Image by the author
array_1 = [1, 2, 3, 'a', 'b', 'c']
array_2 = [4, 5, 6, 7]
combined = [array_1, array_2]
print(combined)
Image by the author

LEAVE A REPLY

Please enter your comment!
Please enter your name here