I am dealing with an issue that involves multiple if and elif conditining..precisely stating, my case goes as follows:
if len(g) == 2:
a = 'rea: 300'
b = 'ref: "%s": {"sds": 200},"%s": {"sds": 300}' % (g[0],g[1])
elif len(g) == 3:
a = 'rea: 400'
b = 'ref: "%s": {"sds": 200},"%s": {"sds": 300},"%s": {"sds": 400}' % (g[0],g[1],g[2])
....
And this elif conditioning is supposed to go up to elif len(g) == 99...so I suppose there should be some elegant way to do this. Moreover, if you observe, there is a pattern with which the 'rea' and 'ref' are progressing, which can be stated as:
if len(g) == x:
a = 'rea: (x*100)+100'
b = 'ref: "%s": {"sds": 200},"%s": {"sds": 300},"%s": {"sds": (x*100)+100}' % (g[0],g[1],g[2])