[Solved] How to divide specific elements in a list and then square the values? [closed]


list = [1,2,3,4,5,6]

for x in range(len(list)):
    if list[x] % 3 == 0: list[x] = list[x]**2

print(list)

solved How to divide specific elements in a list and then square the values? [closed]