How to find min and max values in a list of tuples in Python

1 Answer

0 votes
list_of_tuples = [('c', 78), ('python', 34), ('c++', 81), ('c#', 99), ('java', 52), ('go', 65)]
  
min_value = min(list_of_tuples, key=lambda tup: tup[1])

print(min_value) 

max_value = max(list_of_tuples, key=lambda tup: tup[1])

print(max_value)  
  
  
  
'''
run:
  
('python', 34)
('c#', 99)
  
'''
 
 

 



answered Jul 25, 2022 by avibootz
...