I have a list of lists, and I wanted to add the various values to index 3 of each list, but only if there is a certain string in this list. How can I do it?
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 more cases of violent crime (corresponds to index 3).