Python virtual environments create a virtual installation of Python inside a project directory. Users can then install and manage Python packages for each project. This allows users to be able to install packages and modify their Python environment without fear of breaking packages installed in other environments.
What is Virtual Environment in Python?
A Python virtual environment is:
Considered as disposable.
Used to contain a specific Python interpreter and software libraries and binaries which are needed to support a project.
Contained in a directory, conventionally either named venv or .venv in the project directory.
Not considered as movable or copyable.
When you install Python software on your computer, it is available for use from anywhere in the filesystem. This is a system-wide installation.
While developing an application in Python, one or more libraries may be required to be installed using the pip utility (e.g., pip3 install somelib). Moreover, an application (let us say App1) may require a particular version of the library − say somelib 1.0. At the same time another Python application (for example App2) may require newer version of same library say somelib 2.0. Hence by installing a new version, the functionality of App1 may be compromised because of conflict between two different versions of same library.
This conflict can be avoided by providing two isolated environments of Python in the same machine. These are called virtual environment. A virtual environment is a separate directory structure containing isolated installation having a local copy of Python interpreter, standard library and other modules.
The following figure shows the purpose of advantage of using virtual environment. Using the global Python installation, more than one virtual environments are created, each having different version of the same library, so that conflict is avoided.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Creation of Virtual Environments in Python using venv
This functionality is supported by venv module in standard Python distribution. Use following commands to create a new virtual environment.
Here, myvenv is the folder in which a new Python virtual environment will be created showing following directory structure −
Directory of C:\pythonapp\myvenv
22-02-202309:53<DIR>.22-02-202309:53<DIR>..22-02-202309:53<DIR> Include
22-02-202309:53<DIR> Lib
22-02-202309:5377 pyvenv.cfg
22-02-202309:53<DIR> Scripts
The utilities for activating and deactivating the virtual environment as well as the local copy of Python interpreter will be placed in the scripts folder.
Note the name of the virtual environment in the parentheses. The Scripts folder contains a local copy of Python interpreter. You can start a Python session in this virtual environment.
Checking If Python is Running Inside a Virtual Environment?
To confirm whether this Python session is in virtual environment check the sys.path.
(myvenv) C:\pythonapp>python
Python 3.10.1(tags/v3.10.1:2cd268a, Dec 62021,19:10:37)[MSC v.192964 bit (AMD64)] on win32
Type "help","copyright","credits"or"license"for more information.>>>import sys
>>> sys.path
['','C:\\Python310\\python310.zip','C:\\Python310\\DLLs','C:\\Python310\\lib','C:\\Python310','C:\\pythonapp\\myvenv','C:\\pythonapp\\myvenv\\lib\\site-packages']>>>
The scripts folder of this virtual environment also contains pip utilities. If you install a package from PyPI, that package will be active only in current virtual environment.
Deactivating Virtual Environment
To deactivate this environment, run deactivate.bat.
First step in the journey of learning Python is to install it on your machine. Today most computer machines, especially having Linux OS, have Python pre-installed. However, it may not be the latest version.
Python is available on a wide variety of platforms including Linux and Mac OS X. Let’s understand how to set up our Python environment.
Python has also been ported to the Java and .NET virtual machines
Local Environment Setup
Open a terminal window and type “python” to find out if it is already installed and which version is installed. If Python is already installed then you will get a message something like as follows:
$ python
Python 3.11.2 (main, Feb 8 2023, 14:49:24) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Downloading Python
The most up-to-date and current source code, binaries, documentation, news, etc., is available on the official website of Python https://www.python.org/
You can download Python documentation from https://www.python.org/doc/. The documentation is available in HTML, PDF, and PostScript formats.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Installing Python
Python distribution is available for a wide variety of platforms. You need to download only the binary code applicable for your platform and install Python.
If the binary code for your platform is not available, you need a C compiler to compile the source code manually. Compiling the source code offers more flexibility in terms of choice of features that you require in your installation.
Here is a quick overview of installing Python on various platforms −
Install Python on Ubuntu Linux
To check whether Python is already installed, open the Linux terminal and enter the following command −
$ python3.11--version
In Ubuntu Linux, the easiest way to install Python is to use apt – Advanced Packaging Tool. It is always recommended to update the list of packages in all the configured repositories.
$ sudo apt update
Even after the update, the latest version of Python may not be available for install, depending upon the version of Ubuntu you are using. To overcome this, add the deadsnakes repository.
To install the latest Python 3.11 version, enter the following command in the terminal −
$ sudo apt-get install python3.11
Check whether it has been properly installed.
$ python3
Python 3.11.2(main, Feb 82023,14:49:24)[GCC 9.4.0] on linux
Type "help","copyright","credits"or"license"for more information.>>>print("Hello World")
Hello World
>>>
Install Python on other Linux
Here are the simple steps to install Python on Unix/Linux machine.
Follow the link to download zipped source code available for Unix/Linux.
Download and extract files.
Editing the Modules/Setup file if you want to customize some options.
Now issue the following commands:
$ run ./configure script
$ make
$ make install
This installs Python at standard location /usr/local/bin and its libraries at /usr/local/lib/pythonXX where XX is the version of Python.
Using Yum Command
Red Hat Enterprise Linux (RHEL 8) does not install Python 3 by default. We usually use yum command on CentOS and other related variants. The procedure for installing Python-3 on RHEL 8 is as follows:
$ sudo yum install python3
Install Python on Windows
It should be noted that Python’s version 3.10 onwards cannot be installed on Windows 7 or earlier operating systems.
The recommended way to install Python is to use the official installer. A link to the latest stable version is given on the home page itself. It is also found at https://www.python.org/downloads/windows/.
You can find embeddable packages and installers for 32 as well as 64-bit architecture.
Double click on the file where it has been downloaded to start the installation.
Although you can straight away proceed by clicking the Install Now button, it is advised to choose the installation folder with a relatively shorter path, and tick the second check box to update the PATH variable.
Accept defaults for rest of the steps in this installation wizard to complete the installation.
Open the Window Command Prompt terminal and run Python to check the success of installation.
C:\Users\Acer>python
Python 3.11.2(tags/v3.11.2:878ead1, Feb 72023,16:38:35)[MSC v.193464 bit (AMD64)] on win32
Type "help","copyright","credits"or"license"for more information.>>>
Python’s standard library has an executable module called IDLE – short for Integrated Development and Learning Environment. Find it from Window start menu and launch.
IDLE contains Python shell (interactive interpreter) and a customizable multi-window text editor with features such as syntax highlighting, smart indent, auto completion etc. It is cross-platform so works the same on Windows, MacOS and Linux. It also has a debugger with provision to set breakpoints, stepping, and viewing of global and local namespaces.
Here are the steps to install Python on Windows machine.
Follow the link for the Windows installer python-XYZ.msi file where XYZ is the version you need to install.
To use this installer python-XYZ.msi, the Windows system must support Microsoft Installer 2.0. Save the installer file to your local machine and then run it to find out if your machine supports MSI.
Run the downloaded file. This brings up the Python install wizard, which is really easy to use. Just accept the default settings, wait until the install is finished, and you are done.
Macintosh Installation
Recent Macs come with Python installed, but it may be several years out of date. See http://www.python.org/download/mac/ for instructions on getting the current version along with extra tools to support development on the Mac. For older Mac OS’s before Mac OS X 10.3 (released in 2003), MacPython is available.
Jack Jansen maintains it and you can have full access to the entire documentation at his website − http://www.cwi.nl/~jack/macpython.html. You can find complete installation details for Mac OS installation.
Setting up PATH
Programs and other executable files can be in many directories, so operating systems provide a search path that lists the directories that the OS searches for executables.
The path is stored in an environment variable, which is a named string maintained by the operating system. This variable contains information available to the command shell and other programs.
The path variable is named as PATH in Unix or Path in Windows (Unix is case sensitive; Windows is not).
In Mac OS, the installer handles the path details. To invoke the Python interpreter from any particular directory, you must add the Python directory to your path.
Setting path at Unix/Linux
To add the Python directory to the path for a particular session in Unix −
In the csh shell − type setenv PATH “$PATH:/usr/local/bin/python” and press Enter.
In the bash shell (Linux) − type export PATH=”$PATH:/usr/local/bin/python” and press Enter.
In the sh or ksh shell − type PATH=”$PATH:/usr/local/bin/python” and press Enter.
Note − /usr/local/bin/python is the path of the Python directory
Setting path at Windows
To add the Python directory to the path for a particular session in Windows −
At the command prompt − type path %path%;C:\Python and press Enter.
Note − C:\Python is the path of the Python directory
Python Environment Variables
Here are important environment variables, which can be recognized by Python −
Sr.No.
Variable & Description
1
PYTHONPATHIt has a role similar to PATH. This variable tells the Python interpreter where to locate the module files imported into a program. It should include the Python source library directory and the directories containing Python source code. PYTHONPATH is sometimes preset by the Python installer.
2
PYTHONSTARTUPIt contains the path of an initialization file containing Python source code. It is executed every time you start the interpreter. It is named as .pythonrc.py in Unix and it contains commands that load utilities or modify PYTHONPATH.
3
PYTHONCASEOKIt is used in Windows to instruct Python to find the first case-insensitive match in an import statement. Set this variable to any value to activate it.
4
PYTHONHOMEIt is an alternative module search path. It is usually embedded in the PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy.
Running Python
There are three different ways to start Python −
Interactive Interpreter
You can start Python from Unix, DOS, or any other system that provides you a command-line interpreter or shell window.
Enter python the command line.
Start coding right away in the interactive interpreter.
$python # Unix/Linux
or
python% # Unix/Linux
or
C:> python # Windows/DOS
Here is the list of all the available command line options −
Sr.No.
Option & Description
1
-dIt provides debug output.
2
-OIt generates optimized bytecode (resulting in .pyo files).
3
-SDo not run import site to look for Python paths on startup.
4
-vverbose output (detailed trace on import statements).
5
-Xdisable class-based built-in exceptions (just use strings); obsolete starting with version 1.6.
6
-c cmdrun Python script sent in as cmd string
7
filerun Python script from given file
Script from the Command-line
A Python script can be executed at command line by invoking the interpreter on your application, as in the following −
$python script.py # Unix/Linux
or
python% script.py # Unix/Linux
or
C: >python script.py # Windows/DOS
Note − Be sure the file permission mode allows execution.
Integrated Development Environment
You can run Python from a Graphical User Interface (GUI) environment as well, if you have a GUI application on your system that supports Python.
Unix − IDLE is the very first Unix IDE for Python.
Windows − PythonWin is the first Windows interface for Python and is an IDE with a GUI.
Macintosh − The Macintosh version of Python along with the IDLE IDE is available from the main website, downloadable as either MacBinary or BinHex’d files.
If you are not able to set up the environment properly, then you can take help from your system admin. Make sure the Python environment is properly set up and working perfectly fine.
We have provided Python Online Compiler/Interpreter which helps you to Edit and Execute the code directly from your browser. Try to click the icon to run the following Python code to print conventional “Hello, World!”.
Below code box allows you to change the value of the code. Try to change the value inside print() and run it again to verify the result.
Open Compiler
# This is my first Python program.# This will print 'Hello, World!' as the outputprint("Hello, World!");
Python is an interpreter-based language. In a Linux system, Python’s executable is installed in /usr/bin/ directory. For Windows, the executable (python.exe) is found in the installation folder (for example C:\python311).
This tutorial will teach you How Python Interpreter Works in interactive and scripted mode. Python code is executed by one statement at a time method. Python interpreter has two components. The translator checks the statement for syntax. If found correct, it generates an intermediate byte code. There is a Python virtual machine which then converts the byte code in native binary and executes it. The following diagram illustrates the mechanism:
Python interpreter has an interactive mode and a scripted mode.
Python Interpreter – Interactive Mode
When launched from a command line terminal without any additional options, a Python prompt >>> appears and the Python interpreter works on the principle of REPL (Read, Evaluate, Print, Loop). Each command entered in front of the Python prompt is read, translated and executed. A typical interactive session is as follows.
>>> price =100>>> qty =5>>> total = price*qty
>>> total
500>>>print("Total = ", total)
Total =500
To close the interactive session, enter the end-of-line character (ctrl+D for Linux and ctrl+Z for Windows). You may also type quit() in front of the Python prompt and press Enter to return to the OS prompt.
>>> quit()
$
The interactive shell available with standard Python distribution is not equipped with features like line editing, history search, auto-completion etc. You can use other advanced interactive interpreter software such as IPython and bpython to have additional functionalities.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Python Interpreter – Scripting Mode
Instead of entering and obtaining the result of one instruction at a time as in the interactive environment, it is possible to save a set of instructions in a text file, make sure that it has .py extension, and use the name as the command line parameter for Python command.
Save the following lines as prog.py, with the use of any text editor such as vim on Linux or Notepad on Windows.
Open Compiler
print("My first program")
price =100
qty =5
total = price*qty
print("Total = ", total)
When we execute above program on a Windows machine, it will produce following result:
C:\Users\Acer>python prog.py
My first program
Total = 500
Note that even though Python executes the entire script in one go, but internally it is still executed in line by line fashion.
In case of any compiler-based language such as Java, the source code is not converted in byte code unless the entire code is error-free. In Python, on the other hand, statements are executed until first occurrence of error is encountered.
Let us introduce an error purposefully in the above code.
Open Compiler
print("My first program")
price =100
qty =5
total = prive*qty #Error in this statementprint("Total = ", total)
Note the misspelt variable prive instead of price. Try to execute the script again as before −
C:\Users\Acer>python prog.py
My first program
Traceback (most recent call last):
File "C:\Python311\prog.py", line 4, in <module>
total = prive*qty
^^^^^
NameError: name 'prive' is not defined. Did you mean: 'price'?
Note that the statements before the erroneous statement are executed and then the error message appears. Thus it is now clear that Python script is executed in interpreted manner.
Python Interpreter – Using Shebang #!
In addition to executing the Python script as above, the script itself can be a selfexecutable in Linux, like a shell script. You have to add a shebang line on top of the script. The shebang indicates which executable is used to interpret Python statements in the script. Very first line of the script starts with #! And followed by the path to Python executable.
Modify the prog.py script as follows −
Open Compiler
#! /usr/bin/python3.11print("My first program")
price =100
qty =5
total = price*qty
print("Total = ", total)
To mark the script as self-executable, use the chmod command
$ chmod +x prog.py
You can now execute the script directly, without using it as a command-line argument.
$ ./hello.py
Interactive Python – IPython
IPython (stands for Interactive Python) is an enhanced and powerful interactive environment for Python with many functionalities compared to the standard Python shell. IPython was originally developed by Fernando Perez in 2001.
IPython has the following important features −
IPython‘s object introspection ability to check properties of an object during runtime.
Its syntax highlighting proves to be useful in identifying the language elements such as keywords, variables etc.
The history of interactions is internally stored and can be reproduced.
Tab completion of keywords, variables and function names is one of the most important features.
IPython’s Magic command system is useful for controlling Python environment and performing OS tasks.
It is the main kernel for Jupyter notebook and other front-end tools of Project Jupyter.
Install IPython with PIP installer utility.
pip3 install ipython
Launch IPython from command-line
C:\Users\Acer>ipython
Python 3.11.2(tags/v3.11.2:878ead1, Feb 72023,16:38:35)[MSC v.193464 bit (AMD64)] on win32
Type 'copyright','credits'or'license'for more information
IPython 8.4.0-- An enhanced Interactive Python. Type '?'forhelp.
In [1]:
Instead of the regular >>> prompt as in standard interpreter, you will notice two major IPython prompts as explained below −
In[1] appears before any input expression.
Out[1]appears before the Output appears.
In [1]: price =100
In [2]: quantity =5
In [3]: total = price*quantity
In [4]: total
Out[4]:500
In [5]:
Tab completion is one of the most useful enhancements provided by IPython. IPython pops up appropriate list of methods as you press tab key after dot in front of object.
IPython provides information (introspection) of any object by putting ? in front of it. It includes docstring, function definitions and constructor details of class. For example to explore the string object var defined above, in the input prompt enter var?.
In [5]: var ="Hello World"
In [6]: var?
Type:str
String form: Hello World
Length:11
Docstring:str(object='')->strstr(bytes_or_buffer[, encoding[, errors]])->str
Create a new string objectfrom the given object. If encoding or
errors is specified, then the object must expose a data buffer
that will be decoded using the given encoding and error handler.
Otherwise, returns the result of object.__str__()(if defined)orrepr(object).
encoding defaults to sys.getdefaultencoding().
errors defaults to 'strict'.
IPython’s magic functions are extremely powerful. Line magics let you run DOS commands inside IPython. Let us run the dir command from within IPython console
In [8]: !dir*.exe
Volume in drive F has no label.
Volume Serial Number is E20D-C4B9
Directory of F:\Python311
07-02-202316:55103,192 python.exe
07-02-202316:55101,656 pythonw.exe
Jupyter notebook is a web-based interface to programming environments of Python, Julia, R and many others. For Python, it uses IPython as its main kernel.
Python is a general-purpose programming language. It is suitable for the development of a wide range of software applications. Over the last few years Python has been the preferred language of choice for developers in the following application areas −
Let’s look into these application areas in more detail:
Data Science
Python’s recent meteoric rise in the popularity charts is largely due to its Data science libraries. Python has become an essential skill for data scientists. Today, real time web applications, mobile applications and other devices generate huge amount of data. Python’s data science libraries help companies generate business insights from this data.
Libraries like NumPy, Pandas, and Matplotlib are extensively used to apply mathematical algorithms to the data and generate visualizations. Commercial and community Python distributions like Anaconda and ActiveState bundle all the essential libraries required for data science.
Machine Learning
Python libraries such as Scikit-learn and TensorFlow help in building models for prediction of trends like customer satisfaction, projected values of stocks etc. based upon the past data. Machine learning applications include (but not restricted to) medical diagnosis, statistical arbitrage, basket analysis, sales prediction etc.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Web Development
Python’s web frameworks facilitate rapid web application development. Django, Pyramid, Flask are very popular among the web developer community. etc. make it very easy to develop and deploy simple as well as complex web applications.
Latest versions of Python provide asynchronous programming support. Modern web frameworks leverage this feature to develop fast and high performance web apps and APIs.
Computer Vision and Image processing
OpenCV is a widely popular library for capturing and processing images. Image processing algorithms extract information from images, reconstruct image and video data. Computer Vision uses image processing for face detection and pattern recognition. OpenCV is a C++ library. Its Python port is extensively used because of its rapid development feature.
Some of the application areas of computer vision are robotics, industrial surveillance, automation, and biometrics etc.
Embedded Systems and IoT
Micropython (https://micropython.org/), a lightweight version especially for microcontrollers like Arduino. Many automation products, robotics, IoT, and kiosk applications are built around Arduino and programmed with Micropython. Raspberry Pi is also very popular alow cost single board computer used for these type of applications.
Job Scheduling and Automation
Python found one of its first applications in automating CRON (Command Run ON) jobs. Certain tasks like periodic data backups, can be written in Python scripts scheduled to be invoked automatically by operating system scheduler.
Many software products like Maya embed Python API for writing automation scripts (something similar to Excel micros).
Desktop GUI Applications
Python is a great option for building ergonomic, attractive, and user-friendly desktop GUI applications. Several graphics libraries, though built in C/C++, have been ported to Python. The popular Qt graphics toolkit is available as a PyQt package in Python. Similarly, WxWidgets has been ported to Python as WxPython. Python’s built-in GUI package, TKinter is a Python interface to the Tk Graphics toolkit.
Here is a select list of Python GUI libraries:
Tkinter − Tkinter is the Python interface to the Tk GUI toolkit shipped with Python’s standard library.
wxPython − This is the Python interface for the wxWidgets GUI toolkit. BitTorrent Client application has been built with wxPython functionality.
PyQt – Qt is one of the most popular GUI toolkits. It has been ported to Python as a PyQt5 package. Notable desktop GUI apps that use PyQt include QGIS, Spyder IDE, Calibre Ebook Manager, etc.
PyGTK − PyGTK is a set of wrappers written in Python and C for GTK + GUI library. The complete PyGTK tutorial is available here.
PySimpleGUI − PySimpleGui is an open-source, cross-platform GUI library for Python. It aims to provide a uniform API for creating desktop GUIs based on Python’s Tkinter, PySide, and WxPython toolkits.
Jython − Jython is a Python port for Java, which gives Python scripts seamless access to the Java GUI libraries on the local machine.
Console-based Applications
Python is often employed to build CLI (command-line interface) applications. Such scripts can be used to run scheduled CRON jobs such as taking database backups etc. There are many Python libraries that parse the command line arguments. The argparse library comes bundled with Python’s standard library. You can use Click (part of Flask framework) and Typer (included in FastAPI framework) to build console interfaces to the web-based applications built by the respective frameworks. Textual is a rapid development framework to build apps that run inside a terminal as well as browsers.
CAD Applications
CAD engineers can take advantage of Python’s versatility to automate repetitive tasks such as drawing shapes and generating reports.
Autodesk Fusion 360 is a popular CAD software, which has a Python API that allows users to automate tasks and create custom tools. Similarly, SolidWorks has a built-in Python shell that allows users to run Python scripts inside the software.
CATIA is another very popular CAD software. Along with a VBScript, certain third-party Python libraries that can be used to control CATIA.
Game Development
Some popular gaming apps have been built with Python. Examples include BattleField2, The Sims 4, World of Tanks, Pirates of the Caribbean, and more. These apps are built with one of the following Python libraries.
Pygame is one of the most popular Python libraries used to build engaging computer games. Pygame is an open-source Python library for making multimedia applications like games built on top of the excellent SDL library. It is a cross-platform library, which means you can build a game that can run on any operating system platform.
Another library Kivy is also widely used to build desktop as well as mobile-based games. Kivy has a multi-touch interface. It is an open-source and cross-platform Python library for rapid development of game applications. Kivy runs on Linux, Windows, OS X, Android, iOS, and Raspberry Pi.
PyKyra library is based on both SDL (Software and Documentation Localisation) and the Kyra engine. It is one of the fastest game development frameworks. PyKyra supports MPEG , MP3, Ogg Vorbis, Wav, etc., multimedia formats.
This tutorial will teach you how to write a simple Hello World program using Python Programming language. This program will make use of Python built-in print() function to print the string.
Hello World Program in Python
Printing “Hello World” is the first program in Python. This program will not take any user input, it will just print text on the output screen. It is used to test if the software needed to compile and run the program has been installed correctly.
Steps
The following are the steps to write a Python program to print Hello World –
Step 1: Install Python. Make sure that Python is installed on your system or not. If Python is not installed, then install it from here: https://www.python.org/downloads/
Step 2: Choose Text Editor or IDE to write the code.
Step 3: Open Text Editor or IDE, create a new file, and write the code to print Hello World.
Step 4: Save the file with a file name and extension “.py”.
Step 5: Compile/Run the program.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Python Program to Print Hello World
# Python code to print "Hello World"print("Hello World")
In the above code, we wrote two lines. The first line is the Python comment that will be ignored by the Python interpreter, and the second line is the print() statement that will print the given message (“Hello World”) on the output screen.
Output
Hello World
Different Ways to Write and Execute Hello World Program
Using Python Interpreter Command Prompt Mode
It is very easy to display the Hello World message using the Python interpreter. Launch the Python interpreter from a command terminal of your Windows Operating System and issue the print statement from the Python prompt as follows −
Example
PS C:\> python
Python 3.11.2(tags/v3.11.2:878ead1, Feb 72023,16:38:35)[MSC v.193464 bit (AMD64)] on win32
Type "help","copyright","credits"or"license"for more information.>>>print("Hello World")
Hello World
Similarly, Hello World message is printed on Linux System.
Example
$ python3
Python 3.10.6(main, Mar 102023,10:55:28)[GCC 11.3.0] on linux
Type "help","copyright","credits"or"license"for more information.>>>print("Hello World")
Hello World
Using Python Interpreter Script Mode
Python interpreter also works in scripted mode. Open any text editor, enter the following text and save as Hello.py
print("Hello World")
For Windows OS, open the command prompt terminal (CMD) and run the program as shown below −
C:\>python hello.py
This will display the following output
Hello World
To run the program from Linux terminal
$ python3 hello.py
This will display the following output
Hello World
Using Shebang #! in Linux Scripts
In Linux, you can convert a Python program into a self executable script. The first statement in the code should be a shebang #!. It must contain the path to Python executable. In Linux, Python is installed in /usr/bin directory, and the name of the executable is python3. Hence, we add this statement to hello.py file
Open Compiler
#!/usr/bin/python3print("Hello World")
You also need to give the file executable permission by using the chmod +x command
$ chmod +x hello.py
Then, you can run the program with following command line −
Python is a general-purpose, high-level programming language. Python is used for web development, Machine Learning, and other cutting-edge software development. Python is suitable for both new and seasoned C++ and Java programmers. Guido Van Rossam has created Python in 1989 at Netherlands’ National Research Institute. Python was released in 1991.
C++ is a middle-level, case-sensitive, object-oriented programming language. Bjarne Stroustrup created C++ at Bell Labs. C++ is a platform-independent programming language that works on Windows, Mac OS, and Linux. C++ is near to hardware, allowing low-level programming. This provides a developer control over memory, improved performance, and dependable software.
Read through this article to get an overview of C++ and Python and how these two programming languages are different from each other.
What is Python?
Python is currently one of the most widely used programming languages. It is an interpreted programming language that operates at a high level. When compared to other languages, the learning curve for Python is much lower, and it is also quite straightforward to use.
In addition to this, Python is the language of choice because it is easy to learn. Because of its excellent syntax and readability, the amount of money spent on maintenance is decreased. The modularity of the programme and the reusability of the code both contribute to its support for a variety of packages and modules.
Using Python, we can perform −
Web development
Data analysis and machine learning
Automation and scripting
Software testing and many more
Features
Here is a list of some of the important features of Python −
Easy to learn − Python has a simple structure, few keywords, and a clear syntax. This makes it easy for the student to learn quickly. Code written in Python is easier to read and understand.
Easy to maintain − The source code for Python is pretty easy to keep up with.
A large standard library − Most of Python’s library is easy to move around and works on UNIX, Windows, Mac.
Portable − Python can run on a wide range of hardware platforms, and all of them have the same interface.
Python Example
Take a look at the following simple Python program −
a =int(input("Enter value for a"))
b =int(input("Enter value for b"))print("The number you have entered for a is ", a)print("The number you have entered for b is ", b)
In our example, we have taken two variables “a” and “b” and assigning some value to those variables. Note that in Python, we don’t need to declare datatype for variables explicitly, as the PVM will assign datatype as per the user’s input.
In Python, the return type of input() is string only, so we have to convert it explicitly to the type of data which we require. In our example, we have converted to int type explicitly through int( ) function.
print() is used to display the output.
Output
On execution, this Python code will produce the following output −
Enter value for a 10
Enter value for b 20
The number you have entered for a is 10
The number you have entered for b is 20
What is C++?
C++ is a statically typed, compiled, multi-paradigm, general-purpose programming language with a steep learning curve. Video games, desktop apps, and embedded systems use it extensively. C++ is so compatible with C that it can build practically all C source code without any changes. Object-oriented programming makes C++ a better-structured and safer language than C.
Features
Let’s see some features of C++ and the reason of its popularity.
Middle-level language − It’s a middle-level language since it can be used for both systems development and large-scale consumer applications like Media Players, Photoshop, Game Engines, etc.
Execution Speed − C++ code runs quickly. Because it’s compiled and uses procedures extensively. Garbage collection, dynamic typing, and other modern features impede program execution.
Object-oriented language − Object-oriented programming is flexible and manageable. Large apps are possible. Growing code makes procedural code harder to handle. C++’s key advantage over C.
Extensive Library Support − C++ has a vast library. Third-party libraries are supported for fast development.
C++ Example
Let’s understand the syntax of C++ through an example written below.
#includeusingnamespace std;intmain(){int a, b;
cout <<"Enter The value for variable a \n";
cin >> a;
cout <<"Enter The value for variable b";
cin >> b;
cout <<"The value of a is "<< a <<"and"<< b;return0;}
In our example, we are taking input for two variables “a” and “b” from the user through the keyboard and displaying the data on the console.
Output
On execution, it will produce the following output −
Enter The value for variable a
10
Enter The value for variable b
20
The value of a is 10 and 20
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Comparison Between Python and C++ across Various Aspects
Both Python and C++ are among the most popular programming languages. Both of them have their advantages and disadvantages. In this tutorial, we shall take a closure look at their characteristic features which differentiate one from another.
Compiled vs Interpreted
Like C, C++ is also a compiler-based language. A compiler translates the entire code in a machine language code specific to the operating system in use and processor architecture.
Python is interpreter-based language. The interpreter executes the source code line by line.
Cross platform
When a C++ source code such as hello.cpp is compiled on Linux, it can be only run on any other computer with Linux operating system. If required to run on other OS, it needs to be compiled.
Python interpreter doesn’t produce compiled code. Source code is converted to byte code every time it is run on any operating system without any changes or additional steps.
Portability
Python code is easily portable from one OS to other. C++ code is not portable as it must be recompiled if the OS changes.
Speed of Development
C++ program is compiled to the machine code. Hence, its execution is faster than interpreter based language.
Python interpreter doesn’t generate the machine code. Conversion of intermediate byte code to machine language is done on each execution of program.
If a program is to be used frequently, C++ is more efficient than Python.
Easy to Learn
Compared to C++, Python has a simpler syntax. Its code is more readable. Writing C++ code seems daunting in the beginning because of complicated syntax rule such as use of curly braces and semicolon for sentence termination.
Python doesn’t use curly brackets for marking a block of statements. Instead, it uses indents. Statements of similar indent level mark a block. This makes a Python program more readable.
Static vs Dynamic Typing
C++ is a statically typed language. The type of variables for storing data need to be declared in the beginning. Undeclared variables can’t be used. Once a variable is declared to be of a certain type, value of only that type can be stored in it.
Python is a dynamically typed language. It doesn’t require a variable to be declared before assigning it a value. Since, a variable may store any type of data, it is called dynamically typed.
OOP Concepts
Both C++ and Python implement object oriented programming concepts. C++ is closer to the theory of OOP than Python. C++ supports the concept of data encapsulation as the visibility of the variables can be defined as public, private and protected.
Python doesn’t have the provision of defining the visibility. Unlike C++, Python doesn’t support method overloading. Because it is dynamically typed, all the methods are polymorphic in nature by default.
C++ is in fact an extension of C. One can say that additional keywords are added in C so that it supports OOP. Hence, we can write a C type procedure oriented program in C++.
Python is completely object oriented language. Python’s data model is such that, even if you can adapt a procedure oriented approach, Python internally uses object-oriented methodology.
Garbage Collection
C++ uses the concept of pointers. Unused memory in a C++ program is not cleared automatically. In C++, the process of garbage collection is manual. Hence, a C++ program is likely to face memory related exceptional behavior.
Python has a mechanism of automatic garbage collection. Hence, Python program is more robust and less prone to memory related issues.
Application Areas
Because C++ program compiles directly to machine code, it is more suitable for systems programming, writing device drivers, embedded systems and operating system utilities.
Python program is suitable for application programming. Its main area of application today is data science, machine learning, API development etc.
Difference Between Python and C++
The following table summarizes the differences between Python and C++ −
Criteria
Python
C++
Execution
Python is an interpreted-based programming language. Python programs are interpreted by an interpreter.
C++ is a compiler-based programming language. C++ programs are compiled by a compiler.
Typing
Python is a dynamic-typed language.
C++ is a static-typed language.
Portability
Python is a highly portable language, code written and executed on a system can be easily run on another system.
C++ is not a portable language, code written and executed on a system cannot be run on another system without making changes.
Garbage collection
Python provides a garbage collection feature. You do not need to worry about the memory management. It is automatic in Python.
C++ does not provide garbage collection. You have to take care of freeing memories. It is manual in C++.
Syntax
Python’s syntaxes are very easy to read, write, and understand.
C++’s syntaxes are tedious.
Performance
Python’s execution performance is slower than C++’s.
C++ codes are faster than Python codes.
Application areas
Python’s application areas are machine learning, web applications, and more.
C++’s application areas are embedded systems, device drivers, and more.
Python is a feature-rich, high-level, interpreted, interactive, and object-oriented scripting language. Python is a versatile and very popular programming language due to its features such as readability, simplicity, extensive libraries, and many more. In this tutorial, we will learn about the various features of Python that make it a powerful and versatile programming language.
This is one of the most important reasons for the popularity of Python. Python has a limited set of keywords. Its features such as simple syntax, usage of indentation to avoid clutter of curly brackets and dynamic typing that doesn’t necessitate prior declaration of variable help a beginner to learn Python quickly and easily.
Dynamically Typed
Python is a dynamically typed programming language. In Python, you don’t need to specify the variable time at the time of the variable declaration. The types are specified at the runtime based on the assigned value due to its dynamically typed feature.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Interpreter Based
Instructions in any programming languages must be translated into machine code for the processor to execute them. Programming languages are either compiler based or interpreter based.
In case of a compiler, a machine language version of the entire source program is generated. The conversion fails even if there is a single erroneous statement. Hence, the development process is tedious for the beginners. The C family languages (including C, C++, Java, C# etc) are compiler based.
Python is an interpreter based language. The interpreter takes one instruction from the source code at a time, translates it into machine code and executes it. Instructions before the first occurrence of error are executed. With this feature, it is easier to debug the program and thus proves useful for the beginner level programmer to gain confidence gradually. Python therefore is a beginner-friendly language.
Interactive
Standard Python distribution comes with an interactive shell that works on the principle of REPL (Read – Evaluate – Print – Loop). The shell presents a Python prompt >>>. You can type any valid Python expression and press Enter. Python interpreter immediately returns the response and the prompt comes back to read the next expression.
>>>2*3+17>>>print("Hello World")
Hello World
The interactive mode is especially useful to get familiar with a library and test out its functionality. You can try out small code snippets in interactive mode before writing a program.
Multi-paradigm
Python is a completely object-oriented language. Everything in a Python program is an object. However, Python conveniently encapsulates its object orientation to be used as an imperative or procedural language – such as C. Python also provides certain functionality that resembles functional programming. Moreover, certain third-party tools have been developed to support other programming paradigms such as aspect-oriented and logic programming.
Standard Library
Even though it has a very few keywords (only Thirty Five), Python software is distributed with a standard library made of large number of modules and packages. Thus Python has out of box support for programming needs such as serialization, data compression, internet data handling, and many more. Python is known for its batteries included approach.
Python’s standard distribution can be downloaded from https://www.python.org/downloads/ without any restrictions. You can download pre-compiled binaries for various operating system platforms. In addition, the source code is also freely available, which is why it comes under open source category.
Python software (along with the documentation) is distributed under Python Software Foundation License. It is a BSD style permissive software license and compatible to GNU GPL (General Public License).
Python is a cross-platform language. Pre-compiled binaries are available for use on various operating system platforms such as Windows, Linux, Mac OS, Android OS. The reference implementation of Python is called CPython and is written in C. You can download the source code and compile it for your OS platform.
A Python program is first compiled to an intermediate platform independent byte code. The virtual machine inside the interpreter then executes the byte code. This behaviour makes Python a cross-platform language, and thus a Python program can be easily ported from one OS platform to other.
GUI Applications
Python’s standard distribution has an excellent graphics library called TKinter. It is a Python port for the vastly popular GUI toolkit called TCL/Tk. You can build attractive user-friendly GUI applications in Python. GUI toolkits are generally written in C/C++. Many of them have been ported to Python. Examples are PyQt, WxWidgets, PySimpleGUI etc.
Database Connectivity
Almost any type of database can be used as a backend with the Python application. DB-API is a set of specifications for database driver software to let Python communicate with a relational database. With many third party libraries, Python can also work with NoSQL databases such as MongoDB.
Extensible
The term extensibility implies the ability to add new features or modify existing features. As stated earlier, CPython (which is Python’s reference implementation) is written in C. Hence one can easily write modules/libraries in C and incorporate them in the standard library. There are other implementations of Python such as Jython (written in Java) and IPython (written in C#). Hence, it is possible to write and merge new functionality in these implementations with Java and C# respectively.
Active Developer Community
As a result of Python’s popularity and open-source nature, a large number of Python developers often interact with online forums and conferences. Python Software Foundation also has a significant member base, involved in the organization’s mission to “Promote, Protect, and Advance the Python Programming Language“
Python also enjoys a significant institutional support. Major IT companies Google, Microsoft, and Meta contribute immensely by preparing documentation and other resources.
Apart from the above-mentioned features, Python has another big list of good features, few are listed below −
It supports functional and structured programming methods as well as OOP.
It can be used as a scripting language or can be compiled to byte-code for building large applications.
It provides very high-level dynamic data types and supports dynamic type checking.
It supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Python was developed by Guido van Rossum (a Dutch programmer) in the late 1980s and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell and other scripting languages. Guido van Rossum wanted Python to be a high-level language that was powerful yet readable and easy to use.
Python is copyrighted. Like Perl, Python source code is now available under the GNU General Public License (GPL).
For many uninitiated people, the word Python is related to a species of snake. Rossum though attributes the choice of the name Python to a popular comedy series Monty Python’s Flying Circus on BBC.
Being the principal architect of Python, the developer community conferred upon him the title of Benevolent Dictator for Life (BDFL). However, in 2018, Rossum relinquished the title. Thereafter, the development and distribution of the reference implementation of Python is handled by a nonprofit organization Python Software Foundation.
Who Invented Python?
Python was invented by a Dutch Programmer Guido Van Rossum in the late 1980s. He began working on Python in December 1989 as a hobby project while working at the Centrum Wiskunde & Informatica (CWI) in the Netherlands. Python’s first version (0.9.0) was released in 1991.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Evolution of Python – The Major Python Versions
Following are the important stages in the history of Python −
Python 0.9.0
Python’s first published version is 0.9. It was released in February 1991. It consisted of features such as classes with inheritance, exception handling, and core data types like lists and dictionaries..
Python 1.0
In January 1994, version 1.0 was released, armed with functional programming tools, features like support for complex numbers etc and module system which allows a better code organization and reuse.
Python 2.0
Next major version − Python 2.0 was launched in October 2000. Many new features such as list comprehension, garbage collection and Unicode support were included with it. Throughout the 2000s, Python 2.x became the dominant version, gaining traction in industries ranging from web development to scientific research. Various useful libraries like like NumPy, SciPy, and Django were also developed.
Python 3.0
Python 3.0, a completely revamped version of Python was released in December 2008. The primary objective of this revamp was to remove a lot of discrepancies that had crept in Python 2.x versions. Python 3 was backported to Python 2.6. It also included a utility named as python2to3 to facilitate automatic translation of Python 2 code to Python 3. Python 3 provided new syntax, unicode support and Improved integer division.
EOL for Python 2.x
Even after the release of Python 3, Python Software Foundation continued to support the Python 2 branch with incremental micro versions till 2019. However, it decided to discontinue the support by the end of year 2020, at which time Python 2.7.17 was the last version in the branch.
Current Version of Python
Meanwhile, more and more features have been incorporated into Python’s 3.x branch. As of date, Python 3.11.2 is the current stable version, released in February 2023.
What’s New in Python 3.11?
One of the most important features of Python’s version 3.11 is the significant improvement in speed. According to Python’s official documentation, this version is faster than the previous version (3.10) by up to 60%. It also states that the standard benchmark suite shows a 25% faster execution rate.
Python 3.11 has a better exception messaging. Instead of generating a long traceback on the occurrence of an exception, we now get the exact expression causing the error.
As per the recommendations of PEP 678, the add_note() method is added to the BaseException class. You can call this method inside the except clause and pass a custom error message.
It also adds the cbroot() function in the maths module. It returns the cube root of a given number.
A new module tomllib is added in the standard library. TOML (Tom’s Obvious Minimal Language) can be parsed with tomlib module function.
Python in the Future
Python is evolving everyday where Python 3.x receiving regular updates. Python’s developers community is focusing on performance improvements making it more efficient while retaining its ease of use.
Python is being heavily used for machine learning, AI, and data science, so for sure its future remains bright. It’s role in these rapidly growing fields ensures that Python will stay relevant for years.
Python is also increasingly becoming the first programming language taught in schools and universities worldwide, solidifying its place in the tech landscape.
Frequently Asked Questions About Python History
1. Who created Python?
Python created by Guido Van Rossum, a Dutch Programmer.
2. Why Python is called Python?
Python does not have any relation to Snake. The name of the Python programming language was inspired by a British Comedy Group Monty Python.
3. When was Python’s first version released?
Python’s first version was released in February 1991.
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.
Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
Python is a Beginner’s Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.
Python is an open-source and cross-platform programming language. It is available for use under Python Software Foundation License (compatible to GNU General Public License) on all the major operating system platforms Linux, Windows and Mac OS.
To facilitate new features and to maintain that readability, the Python Enhancement Proposal (PEP) process was developed. This process allows anyone to submit a PEP for a new feature, library, or other addition.
The design philosophy of Python emphasizes on simplicity, readability and unambiguity. Python is known for its batteries included approach as Python software is distributed with a comprehensive standard library of functions and modules.
Python’s design philosophy is documented in the Zen of Python. It consists of nineteen aphorisms such as −
Beautiful is better than ugly
Explicit is better than implicit
Simple is better than complex
Complex is better than complicated
To obtain the complete Zen of Python document, type import this in the Python Shell −
>>>import this
This will produce following 19 aphorisms –
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!
Python supports imperative, structured as well as object-oriented programming methodology. It provides features of functional programming as well.
Pythonic Code Style
Python leaves you free to choose to program in an object-oriented, procedural, functional, aspect-oriented, or even logic-oriented way. These freedoms make Python a great language to write clean and beautiful code.
Pythonic Code Style is actually more of a design philosophy and suggests to write a code which is :
Clean
Simple
Beautiful
Explicit
Readable
The Zen of Python
The Zen of Python is about code that not only works, but is Pythonic. Pythonic code is readable, concise, and maintainable.
Today, Python is one of the most popular programming languages. Although it is a general-purpose language, it is used in various areas of applications such as Machine Learning, Artificial Intelligence, web development, IoT, and more.
This Python tutorial has been written for the beginners to help them understand the basic to advanced concepts of Python Programming Language. After completing this tutorial, you will find yourself at a great level of expertise in Python, from where you can take yourself to the next levels to become a world class Software Engineer.
This Python tutorial is based on the latest Python 3.11.2 version.
What is Python?
Python is a very popular general-purpose interpreted, interactive, object-oriented, and high-level programming language. Python is dynamically-typed and garbage-collected programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL).
Python supports multiple programming paradigms, including Procedural, Object Oriented and Functional programming language. Python design philosophy emphasizes code readability with the use of significant indentation.
This tutorial gives a complete understanding of Python programming language starting from basic conceopts to advanced concepts. This tutorial will take you through simple and practical approaches while learning Python Programming language.
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
Python Jobs
Today, Python is very high in demand and all the major companies are looking for great Python Programmers to develop websites, software components, and applications or to work with Data Science, AI, and ML technologies. When we are developing this tutorial in 2022, there is a high shortage of Python Programmers where as market demands more number of Python Programmers due to it’s application in Machine Learning, Artificial Intelligence etc.
Today a Python Programmer with 3-5 years of experience is asking for around $150,000 annual package and this is the most demanding programming language in America. Though it can vary depending on the location of the Job. It’s impossible to list all of the companies using Python, to name a few big companies are:
Google
Intel
NASA
PayPal
Facebook
IBM
Amazon
Netflix
Pinterest
Uber
Many more…
So, you could be the next potential employee for any of these major companies. We have developed a great learning material for you to learn Python Programming which will help you prepare for the technical interviews and certification exams based on Python. So, start learning Python using this simple and effective tutorial from anywhere and anytime absolutely at your pace.
Why to Learn Python?
Python is consistently rated as one of the world’s most popular programming languages. Python is fairly easy to learn, so if you are starting to learn any programming language then Python could be your great choice. Today various Schools, Colleges and Universities are teaching Python as their primary programming language. There are many other good reasons which makes Python as the top choice of any programmer:
Python is Open Source which means its available free of cost.
Python is simple and so easy to learn
Python is versatile and can be used to create many different things.
Python has powerful development libraries include AI, ML etc.
Python is much in demand and ensures high salary
Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Python:
Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
Python is a Beginner’s Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.
Python Online Compiler
Our Python programming tutorial provides various examples to explain different concepts. We have provided Online Python Compiler/Interpreter. You can Edit and Execute almost all the examples directly from your browser without the need to set up your development environment.
Try to click the icon to run the following Python code to print conventional “Hello, World!”.
Below code box allows you to change the value of the code. Try to change the value inside print() and run it again to verify the result.
Open Compiler
# This is my first Python program.# This will print 'Hello, World!' as the outputprint("Hello, World!");
Careers with Python
If you know Python nicely, then you have a great career ahead. Here are just a few of the career options where Python is a key skill:
Game developer
Web designer
Python developer
Full-stack developer
Machine learning engineer
Data scientist
Data analyst
Data engineer
DevOps engineer
Software engineer
Many more other roles
Characteristics of Python
Following are important characteristics of Python Programming −
It supports functional and structured programming methods as well as OOP.
It can be used as a scripting language or can be compiled to byte-code for building large applications.
It provides very high-level dynamic data types and supports dynamic type checking.
It supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
Applications of Python
Python is a general purpose programming language known for its readability. It is widely applied in various fields.
Python frameworks like Django, and Pyramid, make the development and deployment of Web Applications easy.
This programming language also extends its applications to computer vision and image processing.
It is also favored in many tasks like Automation, Job Scheduling, GUI development, etc.
Features of Python
The latest release of Python is 3.x. As mentioned before, Python is one of the most widely used language over the web. I’m going to list few of them here:
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
Easy-to-maintain − Python’s source code is fairly easy-to-maintain.
A broad standard library − Python’s bulk of the library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
Extendable − You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient.
Databases − Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs than shell scripting.
Target Audience
This tutorial has been prepared for the beginners to help them understand the basics to advanced concepts of Python programming language. After completing this tutorial, you will find yourself at a great level of expertise in Python programming, from where you can take yourself to the next levels.
Prerequisites
Although it is a beginners tutorial, we assume that the readers have a reasonable exposure to any programming environment and knowledge of basic concepts such as variables, commands, syntax, etc.