Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,037 questions

40,797 answers

573 users

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

Related questions

1 answer 78 views
2 answers 121 views
1 answer 29 views
1 answer 76 views
1 answer 83 views
...