Modifying List Elements in Python
List elements can be modified in the same way as string characters:
lst = [1, 2, 3]
lst[0] = '!'
print(lst) # ['!', 2, 3]
Given a list:
lst = [1, 2, 3, 4, 5]
Replace its second element with the number 10.
Given a list:
lst = ['a', 'b', 'c', 'd']
Replace the last element of the list with a boolean value.
The lists are given:
lst1 = [1, 2, 3]
lst2 = ['a', 'b', 'c']
Replace the last element of the list lst1 with the last element of lst2. Print the first list to the console.