I have a list in python. This list has sublist in it. for example:
[['85.', 'Document', 'will', 'discuss', 'allegations,', 'or', 'measures', 'being', 'taken', 'against,', 'corrupt', 'public', 'officials', 'of', 'any', 'governmental', 'jurisdiction', 'worldwide.'], ['56.', 'Document', 'will', 'include', 'a', 'prediction', 'about', 'the', 'prime', 'lending', 'rate,', 'or', 'will', 'report', 'an', 'actual', 'prime', 'rate', 'move.'], and so on]
when i print mylist[0], i get the following:
['85.', 'Document', 'will', 'discuss', 'allegations,', 'or', 'measures', 'being', 'taken', 'against,', 'corrupt', 'public', 'officials', 'of', 'any', 'governmental', 'jurisdiction', 'worldwide.']
when i print mylist[0][0] i get 85.
I am new to python and i dont understand how to access these values(85, 56, and so on) inside a for loop, so that i can delete all the numbers. i.e 85, 56, and so on.
- Also I have a similar list
[[1, 23], [2, 34], [3, 45], [1, 45], [2, 44]]and i want to add all the second elements where the 1st element is the same. i.e i want to add 23 + 45 (because both have 1 as their 1st element). I understand i need a for loop, but i am new to python, and i am not able to understand the loops.