Python sort 🗄️

Python sort sorting tutorial example explained #python #sorting #sort # ------------------------------------------------------------------- # sort() method = used with lists # sort() function = used with iterables students = ((“Squidward“, “F“, 60), (“Sandy“, “A“, 33), (“Patrick“,“D“, 36), (“Spongebob“,“B“, 20), (““,“C“, 78)) grade = lambda grades:grades[1] # (key=age) # sorts current list sorted_students = sorted(students,key=grade) # sorts and creates a new list for i in sorted_students: print(i) # ------------------------------------------------------------------- Bro Code merch store 👟 : =========================================================== =========================================
Back to Top