I have a list of counters in my code and if it is possible I'd like to avoid to write an if condition for each of them.
I figured out the following solution in python 3, but it doesn't works.... how to?
def myfunc():
...
...
for a in list1:
<do something>
for b in list2:
a=0
b=0
c=0
<do something>
for c in list3:
<do something>
if <condition> is true>:
for element in a list:
<do something>
for i in ['a', 'b', 'c']:
if element == i:
i += 1
I don't want to create variables on fly: I need this list of counters (placed inside another loop function) to be increased when match element in the list. What may be relevant to say is that this list of counters is placed inside a function and after a series of nested loops