• Home
  • /
  • Blog
  • /
  • 10 Interesting Facts About Python You Would Like To Know

10 Interesting Facts About Python You Would Like To Know

facts about python

This post is also available in: हिन्दी (Hindi) العربية (Arabic)

Python is an interpreted high-level general-purpose programming language.  It was created by Guido van Rossum, and released in 1991. People use Python to build games, online tools, and websites. Python uses a mixture of recognizable words and characters, so it can be easily read and understood by humans. It contains collections or libraries of preprogrammed code that you can use in your programs. This makes it easier to write complicated programs quickly. 

Python is not only used in web development but in other areas also like back end development, software development, data science, and writing system scripts among others. Python is extensively used to introduce coding for kids.

Interesting Facts About Python Programming

If you’re already a Python coder or learning Python, you might have already known some of these facts. But it would still be interesting to know some other interesting facts about Python, that you don’t know before.

1. Python was a Hobby Project

One of the amazing facts about Python programming is the fact that it is actually one person’s work. Usually, new programming languages are developed and published by large companies employing lots of professionals, and due to copyright rules, it is very hard to name any of the people involved in the project. Python is an exception.

Python wasn’t created as a need for a new programming language. It originated as a pastime during holidays. In December 1989, Python’s creator Guido Van Rossum was looking for a hobby project to keep him occupied in the week around Christmas. He had been thinking of writing a new scripting language that’d be a descendent of ABC and also appeal to Unix/C hackers. He chose to call it Python.

2. Python was named after a TV Show

Whilst Guido Van Rossum was implementing Python, he was also reading the published scripts from Monty Python’s Flying Circus. Monty Python’s Flying Circus is a BBC Comedy TV series from 1969. It is a highly viewed TV series and is rated 8.8 in IMDB.

facts about python

3. Variants of Python

Python has a number of variants:

  • CPython – Written in C, the most common implementation of Python
  • JPython – Written in Java, compiles to bytecode
  • IronPython – Implemented in C#, an extensibility layer to frameworks written in .NET
  • Brython – Browser Python, runs in the browser
  • RubyPython – Bridge between Python and Ruby interpreters
  • PyPy – Implemented in Python
  • MicroPython – runs on a microcontroller

4. Zen of Python

Tim Peters, a major contributor to the Python community, wrote this poem to highlight the philosophies of Python.

CodingHero - 10 Interesting Facts About Python You Would Like To Know 1 10 Interesting Facts About Python You Would Like To Know 952 35 1

If you type in “import this” in your Python IDLE, you’ll find this poem:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.

Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.

Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.

There should be one— and preferably only one —obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.

If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea—let’s do more of those!

5. You can define Infinite Value

The concept of representing infinity as an integer violates the definition of infinity itself. As of 2020, there is no such way to represent infinity as an integer in any programming language so far. But in Python, as it is a dynamic language, float values can be used to represent an infinite integer. 

One can use float(‘inf’) as an integer to represent it as infinity. Below is one example code to illustrate the use of infinity in Python.

import numpy as np
import math
# Defining a positive infinite integer
a = np.inf
# Defining a negative infinite integer
b = -np.inf
# Define a finite integer
c = 300
# check if a in infinite
# check if b in infinite
# check if c in infinite



6. Python over French

The programming language Python has overtaken French as the most popular language taught in primary schools, according to a new survey.

Six out of ten parents want their primary school-age children to learn the coding language over French. While 75% of primary school children said they would rather learn how to program a robot than learn the modern foreign language.

Python had the most global searches on Google (182,000 monthly searches) and YouTube ( 53,000 monthly searches) for a combined volume of  235,000 each month.

7. Python follows Chain Comparison

Checking for conditions is very common in programming languages such as

a < b
CodingHero - 10 Interesting Facts About Python You Would Like To Know 1 10 Interesting Facts About Python You Would Like To Know 952 34

Python allows chain comparison, meaning that you can compare more than two values (variables) at a time. The chaining of operators can be written as follows:

if a < b < c:

In most of the languages the above statement is implemented as

if a < b and b < c

Following is an example of chain comparison in Python

# Python code to illustrate
# chaining comparison operators
x = 5
print(1 < x < 10)
print(10 < x < 20 )
print(x < 10 < x*10 < 100)
print(10 > x <= 9)
print(5 == x > 4)



8. Functions in Python can return Multiple Values

Python functions can return multiple values. These values can be stored in variables directly. A function is not restricted to return a variable, it can return zero, one, two or more values.

This is the default property of Python to return multiple values/variables which is not available in many other programming languages like C++ or Java.

For returning multiple values from a function, we can return tuple, list or dictionary object as per our requirement.

def func(x):
   y0 = x+ 1
   y1 = x * 3
   y2 = y0 ** 3
   return (y0, y1, y2)

9. Python can implement ‘else’ clause within ‘for’ and ‘while’ loop

‘for’ and ‘while’ are looping constructs in most of the programming languages and ‘else’ is used in conditional statement ‘if’. 

In Python, the ‘else’ statement is limited to ‘if’ and ‘try’ statements. If you add an ‘else’ block after a ‘for’ or ‘while’ loop, the statements inside the ‘else’ block are executed only after the loop completes normally. If the loop raises an exception or reaches a break statement, the code under ‘else’ does not execute. This can be good for search operations.

i = 1
while i < 6:
  i += 1
  print("i is no longer less than 6")
for i in range(1, 4):
else:  # Executed because no break in for
    print("No Break")


No Break

10. Python supports Function Unpacking

Function Argument Unpacking is another awesome feature of Python. One can unpack a list or a dictionary as function arguments using * and ** respectively. This is commonly known as Splat operator. Following is one such example:

def point(x, y):
foo_list = (3, 4)
bar_dict = {'y': 3, 'x': 2}
print(*foo_list) # Unpacking Lists
print(**bar_dict) # Unpacking Dictionaries


3  4
2  3


Python is a high-level programming language. This means that it is designed to be efficient and flexible, rather than small and fast. It’s a popular language for general-purpose programming. It is frequently used for Web development, system administration, GUI development, scientific computing, and many other applications. It is one of the most popular programming languages in use today.

More on Python:

Image Credit: Background vector created by brgfx – www.freepik.com

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}