Hi everyoneđ , In this article, we will discuss the Facts and the advantages of Python. You can listen to my podcast on YouTube.
Python has been one of the most popular programming languages for the last few years. Pythonâs simple syntax and large open-source support make it very popular. Python is almost everywhere including web development, data science, AI, microprocessor. Here are some interesting facts about Python.
1. Python is on Mars
Python is used in the Mars rover made by NASA. Python packages are used to record, process the images, and videos.
2. Python is older than Java
First version of Python was first released on Feb 20, 1991 and the first version of Java was on Jan 23, 1996. But a recent increase in popularity for Python seems like it is newer compared to Java.
3. Python has multiple flavors
Python has multiple implementations in various languages. Some of them are
CPython : This is the standard Python which is written in C language
Jython : Here Python code is compiled using Java Byte code and executed using jvm
IronPython : It is written in C# language
PyPy : Python written using Python itself
MicroPython : Python run on microcontrollers
4. We can define infinite value in Python
Defining infinite value is not supported by many programming languages. But Python allows the user to define infinite value.
postive_infinity = float(âinfâ)
negative_infinity = float(â-infâ)
5. Python can return multiple values
Most of the languages do not support multiple returns directly. But a Python function can have multiple returns.
code
def func():
return 1, 2
a = func()
print(a)
output (1, 2)
6. Python influences JavaScript
Python is the one of the languages that influenced the development of JavaScript. Handling of string, array, and regular expression is influenced by Python and Perl.
7. List can be reversed using slicing operator
We can easily reverse a list using the slicing operator.
code
numbers = [1, 2, 3, 4, 5]
reversed = numbers[::-1]
output
[5, 4, 3, 2, 1]
8. Python is named after a television show
Python is named after a BBC comedy series Monty Pythonâs Flying Circus.
9. String Literal concatenation
If we type two string separated by space then python will automatically concatenate the strings. code
a = âHello â âWorldâ
print(a)
output
âHello Worldâ
10. Else block for loops
Python can haveâelse blockâ for âfor and while loops.â Else block gets executed when there is no break in the loop.
Code without break
for i in range(5):
print(i)
else:
print(â0 to 4 printedâ)
Output
0 1 2 3 4 0 to 4 printed
Code with break
for i in range(5):
print(i)
if i == 2:
break
else:
print(â0 to 4 printedâ)
Output
0 1 2
Alright, guys! I hope this article was helpful for you if it is the leave your comments below. I will meet you in another article until then KEEP CODINGđ€.
References