Write a Python program to find a tuple, the smallest second index value from a list of tuples

  • برمجة
  • برمجة بايثون

Write a Python program to find a tuple, the smallest second index value from a list of tuples.

الأجوبة

x = [(4, 1), (1, 2), (6, 0)]
print(min(x, key=lambda n: (n[1], -n[0])))
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...