Hi,
I have created the following code to check a list and then determine which is true then update the variables associated with the correct if else statement. My problem is it doesn't update any of the variable even if true.
As you can see, the var ch should be the first one chosen and the appropriate variables updated.
Also, is there a more simplified way to check all these occurances? This seems a very long winded way of checking for an occurance.
def bbf(*args):
'''receive updates to groups'''
args = list(args)
index=0
for arg in args:
args[index]+=1
index +=1
return tuple(args)
def main():
c=m=b=e=t=s=f=o=0
ch = ['Fname Sname',1,0,0,0,0]
if ch[1:5] == [1,0,0,0,0]:
c,m,b,e,t = bbf(c,m,b,e,t)
else:
if ch[2:5] == [0,0,0,1]:
c,m,b,e,f = bbf(c,m,b,e,f)
else:
if ch[2:5] == [0,0,1,0]:
b,e,t,f,o = bbf(b,e,t,f,o)
else:
if ch[2:5] == [0,0,1,1]:
e,f,o = bbf(e,f,o)
else:
if ch[2:5] == [0,1,0,0]:
c,m,e,t = bbf(c,m,e,t)
else:
if ch[2:5] == [0,1,1,0]:
c,e,t,f,o = bbf(c,e,t*2,f,o)
else:
if ch[2:5] == [0,1,1,1]:
e,f,o = bbf(e,f,o)
else:
if ch[2:5] == [0,1,0,1]:
e,f,o = bbf(e,f,o)
else:
if ch[2:5] == [1,0,0,0]:
c,m,e,t,s = bbf(c,m,e,t,s)
else:
if ch[2:5] == [1,1,0,0]:
c,m,e,t = bbf(c,m,e,t*2)
else:
if ch[2:5] == [1,1,1,0]:
e,t,f,o = bbf(e,t*2,f,o)
else:
if ch[2:5] == [1,1,1,1]:
e,f,o = bbf(e,f,o)
else:
if ch[2:5] == [1,0,1,0]:
e,t,s,f,o = bbf(e,t,s,f,o)
else:
if ch[2:5] == [1,0,0,1]:
c,m,e,s,f = bbf(c,m,e,s,f)
I hope I have posted it correctly this time.
macca1111