If you want to use tuples, see:
https://stackoverflow.com/questions/1208...field-name
however, consider using a dictionary:
https://stackoverflow.com/questions/1208...field-name
however, consider using a dictionary:
debug = True people = { 'bob': {'Name': 'Bob', 'Age': 55, 'Height': 165, 'Weight': 70}, 'doe': {'Name': 'Doe', 'Age': 45, 'Height': 185, 'Weight': 90}, 'john': {'Name': 'John', 'Age': 50, 'Height': 175, 'Weight': 85} } max_age = [None, 0] max_height = [None, 0] max_weight = [None, 0] for person, values in people.items(): if values['Age'] > max_age[1]: max_age[0] = values['Name'] max_age[1] = values['Age'] if values['Height'] > max_height[1]: max_height[0] = values['Name'] max_height[1] = values['Height'] if values['Weight'] > max_weight[1]: max_weight[0] = values['Name'] max_weight[1] = values['Weight'] print(f'{max_age[0]} is the oldest at {max_age[1]} years.') print(f'{max_height[0]} is the tallest at {max_height[1]} inches.') print(f'{max_weight[0]} is the heaviest at {max_weight[1]} lbs.') # if you are not using python 3.6, replace above with: # print('{} is the oldest at {} years.'.format(max_age[0], max_age[1])) # print('{} is the tallest at {} inches.'.format(max_height[0], max_height[1])) # print('{} is the heaviest at {} lbs.'.format(max_weight[0], max_weight[1]))results:
Output:Bob is the oldest at 55 years.
Doe is the tallest at 185 inches.
Doe is the heaviest at 90 lbs.