PYTHON PROGRAMMING IN AND OUT
PYTHON FOR ALL
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.
History of Python
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.
4. What was the first version of Python?
Python's first version was Python 0.9.0
5. When was Python 3.0 version released?
Python 3.0 version was released in December 2008.
features of python
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.

Python's most important features are as follows:
- Easy to learn
- Dynamically typed
- interpreter based
- interactive
- Multi-paradigm
- standard library
- Open source
- cross platform
- Database connection
- Extensible
- Active developer community
- GUI development
- Game development
Easy to Learn
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.
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+1 7 >>> 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 an object oriented language 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.
Some of the Python's popular modules are:
TKINTER
NUMPy
Panda
Pygame
Matplotlib
Time
Open Source and Cross Platform
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, Android. 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, , EasyGUI 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 Redis and 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 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.
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.
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 1
Example 2
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
#!/usr/bin/python3 print ("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 −
$ ./hello.py
This will display the following output
Hello World
Comments
Post a Comment