7.3. Update Elements#

names=['Sahil','Sonia','Sourav']
age=[10,20,30]

7.3.1. Update based on position of element#

names[0]='Sahil Choudhary'
names
['Sahil Choudhary', 'Sonia', 'Sourav']

7.3.2. Update based on value of elements#

for index,x in enumerate(names):
    if "Sonia" in names:
        names[index]='Sonia Choudhary'
names
['Sonia Choudhary', 'Sonia Choudhary', 'Sourav']