1
I have a list of lists, and I wanted to add up the various values for the Indice 3 of each list, but only if there is a certain string in this list. How can I do?
For example I have this list:
[['ALABAMA', 'Abbeville', 2645, 11, 63], ['ALABAMA', 'Adamsville', 4481, 19, 321], ['ALABAMA', 'Addison', 744, 1, 25], ['ALABAMA', 'Alabaster', 31170, 44, 640], ['ALABAMA', 'Alexander City', 14692, 119, 661], ['ALABAMA', 'Aliceville', 2419, 7, 48], ['ALABAMA', 'Andalusia', 9079, 34, 491], ['ALABAMA', 'Anniston', 22648, 461, 1988], ['ALABAMA', 'Arab', 8295, 32, 640], ['ALABAMA', 'Ardmore', 1304, 2, 31], ['ALABAMA', 'Arley', 353, 3, 27], ['ALABAMA', 'Ashford', 2177, 2, 54], ['ALABAMA', 'Ashland', 1926, 9, 63],['ARIZONA', 'Chandler', 248718, 575, 5900], ['ARIZONA', 'Chino Valley', 10850, 50, 207], ['ARIZONA', 'Clarkdale', 4090, 5, 51], ['ARIZONA', 'Clifton', 3499, 11, 42], ['ARIZONA', 'Coolidge', 11820, 66, 662], ['ARIZONA', 'Cottonwood', 11285, 44, 401], ['ARIZONA', 'Eagar', 5034, 15, 106]]
And the statement says: Determine the name of the state with the most violent crime cases (corresponds to Dice 3).
And what was your difficulty? The answer "I couldn’t even begin" is not valid, as this only shows that you should review the content studied before trying again. Please edit your question, add the code you tried to do and explain what didn’t work.
– Woss