Sorting Classes in Python

Subscribers:
50,600
Published on ● Video Link: https://www.youtube.com/watch?v=TT4SRUmrWNs



Duration: 0:00
197 views
6


Python Classes and Object Oriented Programming. How to sort classes in python? Implementing the _lt_ operator, along with other comparison operators, to allow sorting for our classes.

(my bad, I made a mistake in the _lt_ implementation the first time, should be numerator1 less than numerator2, not other.numerator)

Starter Code: https://github.com/ImKennyYip/python-oop/blob/master/2. Dunder Methods (Polymorphism)/Fraction.py
Github: https://github.com/ImKennyYip/python-oop

Python Object Oriented Programming Playlist:
   • Python Object Oriented Programming  

Python Data Structures and Algorithms Playlist:
   • Python Data Structures and Algorithms  

Python Game Programming Projects Playlist:
   • Python Game Programming Tutorial  

Subscribe for more coding tutorials 😄 !