row_1 = ['Facebook', 0.0, 'USD', 2974676, 3.5] row_2 = ['Instagram', 0.0, 'USD', 2161558, 4.5] row_3 = ['Clash of Clans', 0.0, 'USD', 2130805, 4.5] row_4 = ['Temple Run', 0.0, 'USD', 1724546, 4.5] row_5 = ['Pandora - Music & Radio', 0.0, 'USD', 1126879, 4.0] app_data_set=[row_1,row_2,row_3,row_4,row_5] list1= for list in app_data_set: print(list) for e in list: print(e) if list.index([e])==-1: print(e) print(list1)
What I expected to happen:
I want to get the rating or last element of the list of list. For that I am using For loop. While looping I am not able to get the index of the element. I want to compare the index of the element I am looping to -1 which is the location of the element in every list. This is not part of the actual question but I am trying to apply the learning from the chapter I have learned later in the course.
What actually happened:
Basically I want to loop through list of list and get the desired element. Once I get the element at the correct location I want to put it into another list.
ValueErrorTraceback (most recent call last) <ipython-input-1-d1e2a08f81af> in <module>() 11 for e in list: 12 print(e) ---> 13 if list.index([e])==-1: 14 print(e) 15 print(list1) ValueError: ['Facebook'] is not in list