I’m trying to write some code that can sum elements inside a list that looks like the following example:
list[(a,b,1),(c,d,2),(e,f,3)]
What I want to do is to sum the numbers inside this list. What is the name of such kind of lists?
Hope you can help me.
Given a list, and assuming you have to sum integers as given in the example
You can do the following
Incase if the number elements are at a defined index, as in the example, you can do