Q:

Write a Python program to find the maximum and minimum values in a given list of tuples

0

Write a Python program to find the maximum and minimum values in a given list of tuples.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

from operator import itemgetter

def max_min_list_tuples(class_students):
    return_max = max(class_students,key=itemgetter(1))[1] 
    return_min = min(class_students,key=itemgetter(1))[1] 
    return return_max, return_min
   
class_students = [('V', 60), ('VI', 70), ('VII', 75), ('VIII', 72), ('IX', 78), ('X', 70)]
print("Original list with tuples:")
print(class_students)
print("\nMaximum and minimum values of the said list of tuples:")
print(max_min_list_tuples(class_students))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now