Introduction to Python Programming Language

VIDYA SHARMA
Analytics Vidhya
Published in
7 min readJul 2, 2020

Hi there!

If you are new to programming or want to learn any new language, then I would suggest you to go for Python. Today Python is one of the most popular programming languages. It is used by several companies like Oracle, Quora, etc. I would like to give you all a quick overview of Python Programming language through this blog. Hope you like it!

Introduction to Python

What is Python?

Python is an object oriented and high level programming language, that was created by Guido van Rossum during 1985–90. The name Python came from the popular British Comedy Show “Monty Python”, and not the snake Python!!

This language has a general public license and uses fewer syntactical constructions than other programming languages.

Nowadays, Python is one of the most popular programming languages worldwide according to the TIOBE index and the number of programmers who use it is growing every day. The language has a huge community of developers around the world.

The Python logo

Short History of Python:

Python has gone through several versions since its existence.

· Python 1.0: It was released in 1994 and laid the basic principles of the language with emphasis on simplicity, that basically included features like lambda, map, filter, and reduce.

· Python 2.0: It was released in 2000, and it added new features such as list, comprehensions, and garbage collection. Different 2.x subversions are still used in various projects and libraries. The symbol x in 2.x means any subversion of Python 2.

· On December 3,2008, Python 3.0 was released. It was designed to rectify the fundamental flaw of the language.

The list of the Python versions, with dates when they came into action.

Characteristics of Python:

· It supports functional and structural programming methods.

· 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.

· It supports automatic garbage collection

· It can easily be integrated with C, C++, COM, CORBA and JAVA.

Advantages of Python:

· It is easy to read and learn.

· It is easier to write a program in Python

· Python has some unique characteristics that are valuable for programmers because they are making codes easy.

· No bug can originate a segmentation fault

· It has wide applicability, and is extensively used by the scientists, engineers and mathematicians

· The language includes a large library with memory management which is another one of the advantages of Python Programming.

· Python is better for automating build systems, collecting test data, server-side applications.

Disadvantages of Python:

· As an interpreted language, Python has a slow speed of execution.

· The language is less suitable for mobile development and game development.

· It has high memory consumption and is not used in web browsers as it is not safe.

Installing Python:

If you are a window user or a Linux user, installing python is a very small and an easy step.

For windows:

Visit the official site of Python i.e. python.org

  • For 32-bit Windows OS, download the x86 file.
  • For 64-bit Windows OS, download the x86–64 file.
www.python.org/downloads/

And there you go! Python will be installed in a few minutes[or may take time according to your internet connection ;)]

You can check whether Python has been installed in your system or not, by the following commands below:

How to Check Python Version in Windows

Most out-of-the-box Windows installations do not come with Python pre-installed. However, it is always a good idea to check.

Open Windows Powershell, and enter the following:

python ––version

If you have Python installed, it will report the version number.

Python version in Windows

Alternately, use the Windows Search function to see which version of Python you have:

Press the Windows key to start a search, then type Python.

For Linux:

With the help of package manager, one can install python:

  1. If you are using Ubuntu, type the following command in the command prompt:

$ sudo apt-get install python3

  1. If you are using Fedora, type the following command in the command prompt:

$ sudo yum install python3

  1. The most recent version of Python 3 will be downloaded and installed. To verify the installation, type:

$ Python

The Python prompt (>>>) will appear.

Check the python version by the below command line.

python ––version

Python version in Linux

IDLE:

IDLE-PYTHON

IDLE or Integrated Development and Learning Environment is an integrated development tool or text editor for python that includes bundles of default python packages.

In the above picture as you can see,

Idle opens, from the dialog window(left figure) you can open an untitled file(right figure)and write your program over there. But you can even write your programs directly in idle python text editor.

Features of Python-text editor:

· coded in 100% pure Python, using the tkinter GUI toolkit.

· Cross-platform works mostly the same on Windows, Unix and macOS

· Search within any window, replace within editor windows, and search through multiple lines.

· Debugger with persistent breakpoints, stepping, and viewing of global and local namespaces

SALIENT FEATURES OF PYTHON:

· Enhanced Readability

· Dynamic Typing

· Interpreted Language

· Extensible Language

· Standard DB2 API

· GUI Programming

· Embeddable

What are Keywords?

Keywords are the fixed words in Python, which are case sensitive and can’t be used as identifiers or variables.

There are 33 keywords in Python 3.7. Below is the list of those keywords.

Keywords in Python

Let’s write our first program in Python!

If you have studied any programming language before, like C or C++. You might be aware of the first program taught in it.

The “Hello World” program.

If we write this program in C or C++, it will be a code of 3–4 lines.

But the same in python, will be done in a single line.

In the below figure, you can find the same program, in two different languages. This is the difference between C, C++ and Python and hence is the reason why Python is called an easy programming language.

Program to print Hello World in language Python on left and C in right.

Now, since you have written your 1st python program, Let’s move forward towards one more interesting and important concept of the language.

Python Data Types:

Data Types are the classification of the data items. They represent the type (the kind) of data on which operations need to be performed.

Numeric Data Type — As the name suggests, numeric data types are the representation used for the numerical values or the numbers.

It is further classified into 3 data types as:

· Integer: positive or negative whole numbers. (example: 1234, -234, etc.).

· Float: real numbers having floating point representation, in which the fractional part is denoted by decimal or any scientific notation. (examples: 55.55, 0.005,1.32E10)

· Complex Number: A number having two parts, real and imaginary as its components. They are represented as x+yi, where x is the real part and y the imaginary part.

Boolean Data Type: Any data representation having two values True and False (but T and F should be capitalizing, true or false is not valid and will throw an error).

Sequence data types: An ordered collection of similar data types. They are classified as:

> String: It is the collection of one or more characters, put in single, double or triple quotes. (‘Hello’, “Hello”, ‘‘‘Hello’’’)

> List: It is the ordered collection of one or more data items (type not necessary to be same). Examples: [ 5, ‘RAVI’, 45.50, False].

> Tuple: An ordered collection of one or more data items, not necessarily of the same type put in parentheses. The contents of a tuple cannot be modified — it is immutable — after the tuple is created. Examples: (1,”Ravi”, 75.50, True)

Dictionary: It is an unordered collection of data types, in the form of a key. These collections are enclosed in curly braces {}.

Example: {1: “Superman”, 2: “Wonder Woman”, 3: “Thor”, 4: “Hulk”, 5: “Black Widow”}

I talked about Python Introduction, Its History, The Python Versions, The keywords and the data types.

In my next blog, I will talk about the Basics of Programming in Python language. And I will be writing some basic programs.

Hope you like the blog and find it useful ❤❤

Thank You!

--

--

VIDYA SHARMA
Analytics Vidhya

An Engineering student, enjoy writing and so I am here.