This content originally appeared on Level Up Coding - Medium and was authored by Sahil Fruitwala
Learn how to install and verify Python installation on your system
Past and Present of Python
Guido van Rossum created Python 0.9.0 in 1991. Guido van Rossum began working on Python in the late 1980s, as a successor to the ABC programming language. Python was designed by keeping readability in mind. The construct of Python and its approach to Object-Oriented was aimed to help programmers write clear, logical code for small and large-scale projects.
After Python 0.9.0, major Python versions were developed and released by the Python Software Foundation (starting from 2.1). There are two major Python versions, Python 2 and Python 3. From the higher level, both seem quite the same except for some syntax changes but they are quite different.
Python 2 was released in 2000 with a new number of features, such as list comprehensions and a garbage collection system. Whereas, Python 3 was released in 2008 and was a major revision of the language that is not completely backward-compatible. As per Python Software Foundation guidelines, Python 2 was discontinued with version 2.7.18 in 2020.
Find more details about Python’s history on Official Documentation or Wikipedia.
Features of Python
Python is a dynamic, high-level, free open source and interpreted programming language. Python supports object-oriented programming as well as procedural-oriented programming.
The main features of Python are:
- Easy to Learn and Use:
Python is easy to learn as compared to other programming languages. Anyone can remember the syntax, rules and regulations of Python very easily. - Expressive Language:
Python can perform complex tasks using a few lines of code. - Platform Independent and Portability:
Python runs in the same manner on different platforms such as Windows, Linux, UNIX, MacOS, etc. The applications which are developed in python on one platform can execute/run on any other platform without making any changes. - Interpreted Language:
In Python, code is executed line by line at a time. Unlike other languages such as C, C++, Java, etc. python does not require compilation of code. As an interpreted language, python code is easy to debug. The source code of python is converted into an immediate form called bytecode.
To learn more about the Difference between Compiled and Interpreted Language you can read this blog on GeeksForGeeks or FreeCodeCamp. - Dynamically Typed Language:
Python does not ask you to declare the type of a variable. - Object-Oriented Language:
Python supports object-oriented approaches and concepts. We can implement OOPs features such as Encapsulation, polymorphic, inheritance, abstraction, etc. in Python. - Large Standard Library:
Python provides a huge number of the in-built library. You can use any of these libraries for your application. You can download and install any third-party modules as well from the Python Package Index. - GUI Programming Support:
You can create Graphical User interfaces (GUI) using modules such as PyQT5, Tkinter and Kivy - Extensible, Integrated and Embeddable:
According to GeeksForGeeks, we can write some Python code into C or C++ language and also we can compile that code in C/C++ language.
We can easily integrated python with other languages like C, C++, etc. Python code can be also embedded in other languages. By embedding, we can provide somewhat scripting capabilities to other languages.
I know this is hard to understand but I just want to show all features. Normally, you will not use this feature. - Free and Open Source & Redistribution:
Python is freely available and as it is open source, source code is also available to the public. Python has adopted the license so that anyone can use and share it after modification of their own.
By showing you these features, I did not want to overwhelm you. I wanted to show you this to let you know the capabilities of Python. So, in future, you will know for what purpose you can and cannot use Python.
How to Install Python
Finally, Wohooo! A first executable practical step towards Python Programming. So, to download python for your system go to the official Python website and download the latest version. Why the latest version?
So far, python 3 has been backward compatible. It means that you can run code from an older version of Python3 on a newer version of Python3.
Windows Systems
Once you have downloaded the executable python installer (with .msi) extension, open that file and follow the steps shown in the images.
To verify the successful install. Open CMD or PowerShell and write the following commands:
python -V
You will see an output similar to what is shown in the image. Note that, versions can be different. The version will be based on the time you have downloaded python.
MacOS Systems
After downloading the installer, open that installer and follow the steps shown in the images.
To verify the successful install, open terminal and write the following commands:
python3 -V
You will see an output similar to what is shown in the image. Note that, versions can be different. The version will be based on the time you have downloaded python.
Linux Systems
Most Debian / Ubuntu / Linux Mint operating systems come with pre-installed python3. To verify if your Ubuntu has python3 installed or not use the following command in the terminal.
python3 -V
If you don’t see any similar output as shown in the image then run the following command in the terminal.
sudo apt update
sudo apt install python3
Redhat / RHEL / CentOS-based operating systems by default come with python 2. To verify python 3 on using the following command:
python3 -V
To install Python 3 use:
yum update -y
yum install -y python3
You will see an output similar to what is shown in the image. Note that, versions can be different. The version will be based on the time you have downloaded python.
Glimpse of Python Code
After the installation and verification process, finally, it is the time! Time to run a small piece of code in python.
We will run the old plain program to print Hello World! in Python. To write this code open any text editor or code editor and write the following code:
print("Hello World")
Now, save this file as hello.py and open any terminal in the directory where you saved this file.
If you are on windows write the following code:
python hello.py
On Linux based systems and Mac, write:
python3 hello.py
You will see an output similar to what is shown in the image.
Conclusion
uhhfff, Finally! We are at the end of this section. I know there is a lot in here to process. The features and the installation processes and history. But this is it.
I hope you enjoyed this section and gained some insights into Python.
If you liked this, share it with your friends or colleague who wants to learn Python as well. Let me know if you need any help or want to discuss something. Reach out to me on Twitter or LinkedIn.
Want to learn more?
Signup for my Newsletter and get the best articles into your inbox.
Thank You for your time 🧡
Introduction to Python was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding - Medium and was authored by Sahil Fruitwala
Sahil Fruitwala | Sciencx (2022-04-26T13:30:10+00:00) Introduction to Python. Retrieved from https://www.scien.cx/2022/04/26/introduction-to-python-3/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.