Skip to main content
Ctrl+K

Mastering Python

  • Learning Python
    • Your first Python application
    • Python Syntax
    • Variables and Types
    • Strings
    • Numbers
    • Booleans
    • Operators
    • Collections
    • Conditions
    • Functions
    • Loops
    • User Input
    • Exception handling
    • Working with Files
    • Modules
    • Classes
    • Iterators
    • JSON
    • Regular Expressions
    • Packages and virtual environments
  • Blog

Posts tagged magic method

Using magic method __contains__

  • 07 September 2023
  • Editor
  • Language
  • class magic method

Python is a high level language and allows you to do a lot of things with ease. One of the things that Python allows you to do is to check if an item is present in a list or tuple for example. This is done using the in operator as shown below.

Read more ...


By Editor

© Copyright 2025, Mastering Python.