• 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.

coding-for-kids-ebook-cover

Get Instant Access To 

Coding For Kids eBook

A must read for every parent

Country
  • Afghanistan 93
  • Albania 355
  • Algeria 213
  • American Samoa 1-684
  • Andorra 376
  • Angola 244
  • Anguilla 1-264
  • Antarctica 672
  • Antigua & Barbuda 1-268
  • Argentina 54
  • Armenia 374
  • Aruba 297
  • Australia 61
  • Austria 43
  • Azerbaijan 994
  • Bahamas 1-242
  • Bahrain 973
  • Bangladesh 880
  • Barbados 1-246
  • Belarus 375
  • Belgium 32
  • Belize 501
  • Benin 229
  • Bermuda 1-441
  • Bhutan 975
  • Bolivia 591
  • Bosnia 387
  • Botswana 267
  • Bouvet Island 47
  • Brazil 55
  • British Indian Ocean Territory 246
  • British Virgin Islands 1-284
  • Brunei 673
  • Bulgaria 359
  • Burkina Faso 226
  • Burundi 257
  • Cambodia 855
  • Cameroon 237
  • Canada 1
  • Cape Verde 238
  • Caribbean Netherlands 599
  • Cayman Islands 1-345
  • Central African Republic 236
  • Chad 235
  • Chile 56
  • China 86
  • Christmas Island 61
  • Cocos (Keeling) Islands 61
  • Colombia 57
  • Comoros 269
  • Congo - Brazzaville 242
  • Congo - Kinshasa 243
  • Cook Islands 682
  • Costa Rica 506
  • Croatia 385
  • Cuba 53
  • Cyprus 357
  • Czech Republic 420
  • Denmark 45
  • Djibouti 253
  • Dominica 1-767
  • Ecuador 593
  • Egypt 20
  • El Salvador 503
  • Equatorial Guinea 240
  • Eritrea 291
  • Estonia 372
  • Ethiopia 251
  • Falkland Islands 500
  • Faroe Islands 298
  • Fiji 679
  • Finland 358
  • France 33
  • French Guiana 594
  • French Polynesia 689
  • French Southern Territories 262
  • Gabon 241
  • Gambia 220
  • Georgia 995
  • Germany 49
  • Ghana 233
  • Gibraltar 350
  • Greece 30
  • Greenland 299
  • Grenada 1-473
  • Guadeloupe 590
  • Guam 1-671
  • Guatemala 502
  • Guernsey 44
  • Guinea 224
  • Guinea-Bissau 245
  • Guyana 592
  • Haiti 509
  • Heard & McDonald Islands 672
  • Honduras 504
  • Hong Kong 852
  • Hungary 36
  • Iceland 354
  • India 91
  • Indonesia 62
  • Iran 98
  • Iraq 964
  • Ireland 353
  • Isle of Man 44
  • Israel 972
  • Italy 39
  • Jamaica 1-876
  • Japan 81
  • Jersey 44
  • Jordan 962
  • Kazakhstan 7
  • Kenya 254
  • Kiribati 686
  • Kuwait 965
  • Kyrgyzstan 996
  • Laos 856
  • Latvia 371
  • Lebanon 961
  • Lesotho 266
  • Liberia 231
  • Libya 218
  • Liechtenstein 423
  • Lithuania 370
  • Luxembourg 352
  • Macau 853
  • Macedonia 389
  • Madagascar 261
  • Malawi 265
  • Malaysia 60
  • Maldives 960
  • Mali 223
  • Malta 356
  • Marshall Islands 692
  • Martinique 596
  • Mauritania 222
  • Mauritius 230
  • Mayotte 262
  • Mexico 52
  • Micronesia 691
  • Moldova 373
  • Monaco 377
  • Mongolia 976
  • Montenegro 382
  • Montserrat 1-664
  • Morocco 212
  • Mozambique 258
  • Myanmar 95
  • Namibia 264
  • Nauru 674
  • Nepal 977
  • Netherlands 31
  • New Caledonia 687
  • New Zealand 64
  • Nicaragua 505
  • Niger 227
  • Nigeria 234
  • Niue 683
  • Norfolk Island 672
  • North Korea 850
  • Northern Mariana Islands 1-670
  • Norway 47
  • Oman 968
  • Pakistan 92
  • Palau 680
  • Palestine 970
  • Panama 507
  • Papua New Guinea 675
  • Paraguay 595
  • Peru 51
  • Philippines 63
  • Pitcairn Islands 870
  • Poland 48
  • Portugal 351
  • Puerto Rico 1
  • Qatar 974
  • Romania 40
  • Russia 7
  • Rwanda 250
  • Réunion 262
  • Samoa 685
  • San Marino 378
  • Saudi Arabia 966
  • Senegal 221
  • Serbia 381 p
  • Seychelles 248
  • Sierra Leone 232
  • Singapore 65
  • Slovakia 421
  • Slovenia 386
  • Solomon Islands 677
  • Somalia 252
  • South Africa 27
  • South Georgia & South Sandwich Islands 500
  • South Korea 82
  • South Sudan 211
  • Spain 34
  • Sri Lanka 94
  • Sudan 249
  • Suriname 597
  • Svalbard & Jan Mayen 47
  • Swaziland 268
  • Sweden 46
  • Switzerland 41
  • Syria 963
  • Sao Tome and Principe 239
  • Taiwan 886
  • Tajikistan 992
  • Tanzania 255
  • Thailand 66
  • Timor-Leste 670
  • Togo 228
  • Tokelau 690
  • Tonga 676
  • Trinidad & Tobago 1-868
  • Tunisia 216
  • Turkey 90
  • Turkmenistan 993
  • Turks & Caicos Islands 1-649
  • Tuvalu 688
  • U.S. Outlying Islands
  • U.S. Virgin Islands 1-340
  • UK 44
  • US 1
  • Uganda 256
  • Ukraine 380
  • United Arab Emirates 971
  • Uruguay 598
  • Uzbekistan 998
  • Vanuatu 678
  • Vatican City 39-06
  • Venezuela 58
  • Vietnam 84
  • Wallis & Futuna 681
  • Western Sahara 212
  • Yemen 967
  • Zambia 260
  • Zimbabwe 263
How Old Is Your Child?
  • Less Than 5 Years
  • 5 - 8 Years
  • 9 - 13 Years
  • 14 - 18 Years
  • 18+ Years

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
print(math.isinf(a))
  
# check if b in infinite
print(math.isinf(b))
  
# check if c in infinite
print(math.isinf(c))

Output:

True
True
False

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)

Output:

True
False
True
True
True

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:
  print(i)
  i += 1
else:
  print("i is no longer less than 6")
for i in range(1, 4):
    print(i)
else:  # Executed because no break in for
    print("No Break")

Output:

1
2
3
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):
    print(x,y)
  
foo_list = (3, 4)
bar_dict = {'y': 3, 'x': 2}
print(*foo_list) # Unpacking Lists
print(**bar_dict) # Unpacking Dictionaries

Output:

3  4
2  3

Conclusion:

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"}
>