Write a Python program to find the maximum and minimum values in a given list of tuples
- برمجة
- برمجة بايثون
- 2021-04-16
- salsabeelalhams99111801528
الأجوبة
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))أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال