[Python] How to add a value to a whole list, but except specific values?

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    I wish to have a list of numbers, e.g. [3,6,-1,8,2,-1] and be able to add 2 to all elements except the -1s, for example, to get [5,8,-1,10,4,-1].

    I've managed to add values to all elements, but have been unable to except values, which I think is due to me being unable to define specific elements within the code.

    Continue reading...

Compartilhe esta Página