In this tutorial, you will learn how to replace certain items of the list?
b=[1,2,3,4,5,6,7,8]
for n, i in enumerate(b):
if i == 1:
b[n] = 10
print(b)
Output:
[10, 2, 3, 4, 5, 6, 7, 8]
If you have any alternative ways to do it, You can comment below.