Introduction to Python

Introduction to Python thumbnail
2K
By Dhiraj 11 March, 2019
python-image

Python is a popular and powerful programming language created by Guido van Rossum and first released in 1991. This language was named by the very popular comedy show Python. Python has become one of the most preferred languages in modern days with an increase in demand for data scientists, Artificial Intelligence and also due to its easy-to-use syntax. In this article, we will start with an introduction to Python and then set up Python on our local system and then write Hello World program using Python to get started with Python.

What is Python

Python is an interpreted, high-level, general-purpose programming language. It is a strongly typed language i.e.every object is associated with a type. Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It is very readable and mostly used for web development(server-side), software development, data science and system scripting.

Python Capabilities

  • Can be used to create web applications using framewroks such as Django, Flask.

  • Can be used to create complex workflows alongside softwares.

  • Easily read and modify files. More on file handling in Python here.

  • It can handle big data and perform complex scientific calculations, cloud configurations using Python based tools such as ANSIBLE, SCIPY

  • Very helpful to create production ready softwares rapidly in a lesser time.

  • Very powerful for deep learning with machine learning platform such as TensorFlow.

Why Python

  • It is safe, quick and efficient.

  • Cross platform and open source.

  • Being an interpreted language, codes can be executed as soon as it is written.

  • Simple syntax for complex logic. Very similar to plain English.

  • Requires less lines of code in comparison to other programming language.

  • It uses new lines(4 spaces in command line) to complete a command, as opposed to other programming languages which often uses semicolons.

  • Python depends on indentation using whitespaces, to define scope - such as the scope of loops, functions and classes.

Python Versions

Python has primarily 2 versions - Version 2 and version 3. Python version 2 is widely deployed legacy language whereas Python 3 is the current version. Python 2 will be maintained until 2020. Hence, all the new development is started with Python 3 and we will be also discussing Python 3 henceforth.

Python Installation

We will be installing Python on Windows 10. For that heead over to the Python download page and based on the OS, you van download the installation packages. I have downloaded Windows x86-64 executable installer. Once downloaded, you can run the .exe file to get it installed. During installation, don't forget to check the option - Add Python 3.7 to PATH

python-installation

Hello World in Python

Once the python is installed, you can search for Python under All Apps and open the Python command line as below. It is pretty much simple in Python to print Hello World.

 print ("Hello World!")
python-hello-word-terminal

Open your notepad and write above code in it and save it as helloworld.py. Now you can open windows command line at the location of file and run python helloworld.py

python-hello-file

Python depends on indentation using whitespaces. All the control statements such as if statements, for loop, while loop is terminated with colon indicating the body will be followed next. Instead of using curly braces for indentation as in other programming languages, Python uses 4 white-spaces for indentation. Below is an example

python-white-space

Conclusion

In this article, we started with an introduction of Python and then set up Python on our local system and then created a Hello World program using Python. In the next article, we will start with Python variables.

Share

If You Appreciate This, You Can Consider:

We are thankful for your never ending support.

About The Author

author-image
A technology savvy professional with an exceptional capacity to analyze, solve problems and multi-task. Technical expertise in highly scalable distributed systems, self-healing systems, and service-oriented architecture. Technical Skills: Java/J2EE, Spring, Hibernate, Reactive Programming, Microservices, Hystrix, Rest APIs, Java 8, Kafka, Kibana, Elasticsearch, etc.

Further Reading on Python