Introduction to Python Programming Language

This section gives you a formal Introduction to Python. In addition to this, you will learn about

  • History of Python.
  • Its advantages and disadvantages.
  • Applications of it.

History of Python

Python is a high level, interpreted general-purpose programming language. Guido van Rossum created this language in the late 1980s.

Guido van Rossum published the initial version in 1991. In 1994, Python reached version 1.0. This version introduced functional programming tools like lambda, map, filter and reduce.

Version 2.0 released in October 2000 included cycle-detecting garbage collector and support for Unicode. A garbage collector is a run time memory management mechanism. The latest version of Python 2 is 2.7.16.

In 2008, Python 3.0 was released. It broke backward-compatibility. In other words, you cannot run a program written in Python 2 using Python 3. You need to modify the syntax before running it using version 3.0.

Backwards-incompatibility solved most of the fundamental design flaws of Python 2. The latest version of Python 3 is 3.7.3.

In this tutorial, we use Python 3.7. We recommend you to install the latest version of Python. Installing Python 2 is not recommended because the maintenance of this version officially terminates from January 1, 2020.

The name Python comes from the famous British comedy show “Monty Pythons Flying Circus”. Van Rossum named the language he created after this show. Because he was, maybe still is a great fan of it.

Why learn Python?

There are many advantages and a few disadvantages to Python. Let’s discuss the advantages first. This will give you an idea about Why learning Python is truly rewarding?

Simple syntax and indentation

Just look at the code below,

p = "Hello World!"
print(p)

It is simple, easy to write, read and understand. If you are completely new to programming, the above code assigns a string value Hello world to the variable p. Then function print() prints the value of p to the screen.

Its simple syntax draws inspiration from mathematics and the English language.

Python uses indentation as a rule to define the blocks of code. Statements or declarations inside functions, loops, etc are called code blocks.

For example, look at the indentation in the Python program below.

my_name = "John Doe"
if my_name == "John Doe":
    print("I am unknown to the world!")
else:
    print("Many of you know me")

Indentation makes Python code look neat and well organized. A well-formatted code is always easy to read, understand and debug.

Python uses significant whitespaces for indentation. Any mismatched indentation results in IndentationError.

Extensive libraries and a lot of frameworks

A library allows you to perform many actions without writing the actual code. A large number of Python libraries make it easier to perform tasks related to data analysis and visualization, machine learning, web development, scripting, IoT, etc.

For example, A library called matplotlib provides a platform to plot quality figures using Python.

Let’s have a look at it. The code below plots a sine wave. This clearly indicates that libraries make Python a powerful language for a wide range of applications.

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 10, 0.2)
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
plt.show()

Output :

Don’t get overwhelmed by the above code.

A framework is an abstraction level tool. To simplify, frameworks provide a platform to design applications without actually doing low-level operations.

For example, a web framework can be used to develop web applications. In this case, you don’t have to write code to perform low-level operations. Web frameworks provide libraries for database access, session management, etc.

Frameworks promote code reuse.

Django, Flask are few of the most popular web frameworks.

High-level language

Python, C, C++, Java, etc are high-level programming languages. There are also low-level or machine-level programming languages.

Computers can only process low-level languages. Therefore every program written in a high-level language must be converted to a low-level language before it is processed. So high-level languages need some extra processing time.

But, writing a program in a high-level language is easier. And the program is shorter when compared to low-level languages. Also, it takes less time to write, easy to read and easy to debug.

High-level languages are portable. This means they can run on different computers with little or no modifications. Low-level languages are mostly machine-specific. You need to rewrite the code to run on another machine.

Interpreted programming language

Programs called compilers and interpreters convert high-level languages to low-level languages.

C, C++, etc. are compiled languages while Python is an interpreted language.

An interpreter reads the program and executes it. In other words, the interpreter reads a line, execute it and then proceeds to the next line. Every time you run the program this process takes place.

A compiler reads the entire program and converts it into object code or executable code. An executor then runs the object code. Once a program is compiled, it can be executed repeatedly without further translation. It saves translation time.

Compiled languages are faster than interpreted languages. While interpreted languages help in faster application development.

Today we need to develop applications in a short span of time. The less processing speed of interpreted languages can be compensated by using devices with more processing power.

Python community

While learning Python, you may come across several doubts. You need a platform to clear them. The same applies to application development. In this case, everything won’t work as you planned. Then you need help from others.

A community is where you collaborate with other programmers. Become a member of a community. Ask your doubts. Get help from others. Collaborate with other members. You will learn a lot of things in the process.

Python is an open-source language. A large community means the availability of many libraries, modules, and packages. You can use them to develop applications. Python grows as its community grows.

We recommend you to join StackOverflow’s Python community. It is the best community out there. Thousands of highly skilled developers are there to help you.

And, also don’t forget to join GitHub.

In-demand programming language

In 2018 IEEE conducted a survey to rank around 47 programming languages. Python topped the list.

Python saw extraordinary growth in the last decade. You can check about this incredible growth from StackOverflow trends.

Read this great article that unveils the growth of Python.

As of now, Python has the 3rd highest number of active repositories on GitHub. Check out this amazing tool to get an idea about it.

According to Indeed.com, a junior Python developer receives a paycheck of around $80,000 per year in the USA. In India, it is about 5 Lakh INR per year.

Disadvantages of Python

To have a good introduction to Python or for that matter any other language, you need to know about its advantages as well as disadvantages.

We have listed the disadvantages of Python below.

  • Slower than C, C++, Java, etc.
  • Less suitable for mobile development.
  • High memory consumption.
  • Underdeveloped database access layer.

Python Uses

An introduction to Python is incomplete without explaining its applications. Let’s discuss what Python can do in the real world.

Because of its enormous advantages over other languages, Python supports a variety of application development.

Take this section as a motivation to learn Python. When you finish the basics of Python, you can start developing applications.

Web Development

Python supports a lot of internet protocols like HTML, XML, JSON, Email Processing, FTP and easy-to-use socket interface (low-level networking interface).

Along with this, the package index has more libraries. They are

  • Requests, a powerful HTTP client library.
  • BeautifulSoup, an HTML parser that can handle all sorts of oddball HTML.
  • feedparser for parsing RSS/Atom feeds.
  • Paramiko, implementing the SSH2 protocol.
  • Twisted Python, a framework for asynchronous network programming.

In addition to this, web frameworks make a developer’s job much easier. They provide a base structure to develop applications.

You can use full-stack frameworks like Django and Pyramid or micro-frameworks like Flask.

Data Science

Data science is a multidisciplinary field of study. Algorithms, processes and scientific methods are used to extract meaningful data. This data is used to take important decisions.

Data Science is an in-demand field.

Python is the most preferred language for data analysis and visualization. IPythonpandasPulp and many other Python-based tools are used extensively used for this task.

Machine Learning

Machine learning is a part of data science. It is a program that automatically learns and improves itself based on observations, experiences and available data. You need not explicitly program it.

It relies on patterns and inferences.

For example, virtual assistants like Alexa use machine learning.

Widely used Python libraries for machine learning are scikit-learn and Tensorflow.

Scripting

Python scripts(small pieces of codes) can be used to automate computer processes and simple tasks. 

For example, you can write a Python code to count the number of unique words in an article.

We have listed a few other applications below.

  • Scientific and numeric computation.
  • Raspberry Pi
  • Desktop GUI development
  • Software development.
  • Game development
  • Developing ERP and e-commerce systems.

Conclusion

To sum up, Python is a great programming language.

Firstly, it is beginner-friendly. Secondly, it has more advantages over other languages. Thirdly and most importantly It can be used to develop a wide range of applications.

We hope you had a good introduction to Python.

Leave a Reply

Close Menu