3
I need to scroll through a list in Python as for example:
l = [2313, 1221, 1333, 66, 0, 0, 0, 0]
I would like it if the current element and the next on the list are zero replaces the current and next element with 1.
Or if the current and previous elements are zero: replaces the current and previous element with 1.
How could I do that?
Hello @Allan, I noticed your new question. But it copied wrong, beware if it is for cycle for, see below how I did
– Miguel
Wow, thank you so much Miguel! I hadn’t noticed that, I’m a beginner in Python and I need to solve an exam allocation problem, so it’s kind of tense haha I’ll pay more attention :D
– Allan
No problem that’s what you want right?
– Miguel
Yeah yeah, great! =)
– Allan