May-22-2018, 01:27 AM
Hello, here's my program:
I would like someone to help me please, thank you!
oooooo =['fg', 'dh', 'df', 'hg', 'sd', 'hnb', 'eee', 'rh', 'ddd', 'vvvv'] aaaaaaa = [542, 861,532,7854,2213,45612,7865,1535,453,452] bbbbbb = [8888,7777,4444,1111,2222,333,555,444,123,453] ccccc = [8888,666,555,4444,222,555,666,444,111,222] fffff = [444,555,555,555,666,8888,4444,8888,4444,77777] abcd = [oooooo]+[aaaaaaa] +[bbbbbb]+[ccccc]+ [fffff] def ppp(x, y): return ((y - x)/x)* 100 def iii(*e): xx = [] yy= [] zz = [] for i in range(len(e[0])): xx += [ppp(e[1][i], e[2][i])] for j in range(len(e[0])): yy += [ppp(e[2][j], e[3][j])] for l in range(len(e[0])): zz += [ppp(e[3][l], e[4][l])] return xx, yy, zzAnd here what I get with >>> iii(abcd):
Error:Traceback (most recent call last):
File "<pyshell#125>", line 1, in <module>
iii(a)
File "C:/Python34/poiuy.py", line 19, in iii
xx += [ppp(e[1][i], e[2][i])]
IndexError: tuple index out of range
I don't understand why my list is called a tuple because there are no () but [] and I don't understand why the index is out of range while it shouldn't because 0 =< i < 10, and the length of the lists = 10. I would like someone to help me please, thank you!