Python is interpreted high level language. In this blog, I will tell you about Python Programming Language.
Are you new in programming and confused or not able to start your programming due to the complex syntax of other programming languages?
Then Python could be a good option for you !!Python is easy to learn and has a simple syntax which helps you to start programming.
So this user guide will help you to start Python !!
Python is interpreted, high level and powerful object-oriented programming language which is created by Guido van Rossum. Python appeared for the first time in 1990 and was released in 1991. The most recent stable version of Python is 3.8.3 on 13th May 2020.
now. Find out More
Python2.0 was released in October 2000.
Python3.0 was released on 3rd December 2008.
What are the features of Python?
- Python is a high-level language.
- It is free and Open Source.
- It is an Object-Oriented Programming/Scripting language and also supports multiple inheritances.
- Python is easy to use which helps to write code in an easy manner.
- Python follows indentation while writing code means you must indent each line of the section by the same whitespaces.
- It is a strong and dynamic typed language which means you don’t need to define the data type while writing code.
- Python is interpreted language (But there is a myth for this statement because while running code it generated .pyc file).
- Python comes with the large standard libraries which help to solve simple as well as complex problems like socket/webserver connection, minor calculative operations, etc.
- It is the platform-independent language which means you can execute compiled code in any operating system.
- Python contains some advanced programming features like generators, decorators, and list/dictionary comprehension.
- Python is an extensible and portable programming language.
- Supports GUI programming.
- Python provides interfaces for most of the databases.
- It helps to create console/web/mobile/scripting/desktop based applications.
- Memory management in Python is very easy as it has automatic garbage collection.
Disadvantages of Python
- It has speed limitations as it is interpreted and compiled as well.
- Python has design restrictions because Python is a dynamic type language but while typecasting inside code sometimes it gives type error.
- Python is weak in mobile computing.
- Incompatibility with the previous versions.
- Sometimes problems with threading.
Philosophy of python is explained in the document THE ZEN OF PYTHON (PEP 20). It includes aphorisms like below,
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.
Before using Python you must have Python in your system. So to check whether Python is installed or not? You can check by entering “python” in your command line or terminal. If python is installed in your system then it will move you to the “Interactive Mode” else it will give “Python is not recognized” error. You can find Python for all Platforms from this link. Now moving for the installation,
Installing Python on Windows
You can find all stable versions of Python for all the compatible windows versions from this link. On Windows, you have the choice to download it for 32-bit and 64-bit.
After downloading Python you can unzip the zip and proceed for the installation. Then set the environment variable to run Python on cmd.
Installing Python on Mac
You can find all stable versions of Python for Mac-osx from this link. Then using the Mac installer you can install Python on mac-osx.
Installing Python on Linux
You can find all stable versions of Python for Linux based systems from this link.
- Red Hat, CentOS, or Fedora: Install the python3 and python3-devel packages (Debian-based distributions).
- Debian or Ubuntu: Install the python3.x and python 3.x-dev packages (apt).
apt install python3-pip
- Gentoo: Install the ‘=python-3.x*’ ebuild (It is basically a text file) (you may have to unmask it first).
Run “Hello World” program
As you know, the structure of python is very simple. So you can create/run programs in a very easy way.
Create/Run program on Interactive mode
- Open command prompt or terminal.
- Then type “python” on the terminal.
- Then you can simply write “Hello World” inside double quotes or in a print statement/function.
Create/Run program using file
- Create a file.
- Then write “Hello World” inside a print function like below,
- print(“Hello World”)
- Then save the file in the “.py” extension.
- Then to run the program using the file you can use below command,
- python file path
How does a Python program run in a system?
As I mentioned above python is interpreted high level language but compiles as well. Below steps will help you to show the process of Python program execution.
- Firstly when we run the source code of the python program.
- Then python compiles code into the byte code.
- A “*.pyc” file creates after compilation of source code.
- Then here PVM(Python Virtual Machine) plays a very important role.
- PVM helps to interpret the byte code.
- After interpreting the byte code python provides the output of the program.
You can also check some other informative blogs
We Would Love to Hear From You!
Hope you find the blog informative! Please feel free to share your feedback in the comments below.
If you still have any issues/queries then please raise a ticket at https://webkul.uvdesk.com/en/customer/create-ticket/
For any doubt contact us at [email protected].
Thanks for paying attention!!