what is == and is in python code example

Example 1: python if name == main example

# It's as if the interpreter inserts this at the top
# of your module when run as the main program.
__name__ = "__main__"

Example 2: == in python

The == operator compares the values of both the operands and checks for value equality. Whereas is operator checks whether both the operands refer to the same object or not. ... Hence list1 and list2 refer to different objects. We can check it with id() function in python which returns the “identity” of an object.