[Solved] How to add an integer to certain elements in a list? [closed]


Here you go:

add_to_elements = [1, 2]

for i in range(len(list_)):
    if i in add_to_elements:
        list_[i] += 50

solved How to add an integer to certain elements in a list? [closed]