Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
3. The "in" operator – behind the scenes
Sorting – sort()
Sorting – sorted()
Sorting – reverse() and reversed()


Good job! The in operator is extremely easy to use. Behind the scenes, however, Python applies somewhat more complex algorithms to quickly determine whether the item is present in the data structure. The algorithm Python chooses may change depending on the data structure.

In this course, we're not going to analyze search algorithms in detail. All we want to point out here is that the in operator may seem extremely simple, but in reality, it performs some computations for you. So if you're writing a performance-heavy app, remember that it might take a lot of your resources.


Click Next exercise to continue.