Python is known for its readable syntax and extensive standard library, but it also contains a few playful surprises hidden inside the language. These Easter eggs are not meant for practical programming; they are small jokes and references added by Python developers.
1. hello Module
This module prints the classic Hello world! message when imported. It is a playful reference to the first program many programmers write when learning a language.
import __hello__
Output
Output:
Hello world!2. Antigravity
Importing it does not change the behavior of gravity or the Python interpreter. Instead, it opens an XKCD comic related to Python in the default web browser.
import antigravity

3. Zen of Python
It has a built-in collection of design principles known as the Zen of Python. It can be displayed by importing the this module.
import this
Output:

4. FLUFL
Python contains a humorous future statement named barry_as_FLUFL. FLUFL stands for Friendly Language Uncle For Life and comes from PEP 401.
from __future__ import barry_as_FLUFL
1 <> 2
Output:
True
5. Braces
Uses indentation rather than curly braces to define blocks of code. Trying to enable braces through a future statement produces one of Python's most famous humorous error messages.
from __future__ import braces
Output:
SyntaxError: not a chance
6. Love Easter Egg
This is a small joke involving the this module. After importing this, assigning it to love creates some amusing identity comparisons.
import this
love = this
print(this is love)
print(love is True)
print(love is False)
print(love is not True or False)
Output
True
False
False
True
7. ROT13 Secret Behind the Zen of Python
Text printed by import this is stored in ROT13-encoded form inside this.py. Python then decodes it before displaying the Zen of Python.
import codecs
text = "Gur Mra bs Clguba"
print(codecs.decode(text, "rot_13"))
Output
The Zen of Python