Dec-12-2017, 07:22 PM
1 2 3 4 5 6 7 8 |
import collections Person = collections.namedtuple( 'Person' , [ 'Name' , 'Age' , 'Height' , 'Weight' ]) person1 = Person(Name = 'Bob' , Age = 55 , Height = 165 , Weight = 70 ) person2 = Person(Name = 'Doe' , Age = 45 , Height = 185 , Weight = 90 ) person3 = Person(Name = 'John' , Age = 50 , Height = 175 , Weight = 85 ) people = [person1, person2, person3] |
I want to know how to sum the people's total ages.
For my above example, the total ages = 55 + 45 + 50 = 150
Thanks,