how to replace list element code example
Example 1: change element in list python
list = ['unchanged', 'unchanged']
list[0] = 'changed'
print(list)
## ['changed', 'unchanged']
Example 2: how to replace an element of a list using list comprehension
new_list = ["A" if element == "a" else element for element in a_list]