Overview and Installation - Python Programming

sohail
sohail

Table of Contents

Python is a general-purpose programming language that is very high in demand. It is one of the most sought after programming languages with limitless applications. Programming in Python is very easy to learn. Since it is a very flexible language. So let us begin on our quest to learning Python.

A Quick Overview

Python is a high-level programming language that was created in 1991. Python has picked up popularity in the last few years. Python can be used to make desktop, web and even mobile phone apps. It also has great application in security and penetration testing, data analytics, AI and Machine Learning. We will begin learning python from more or less ground zero level. Some exposure to programming will definitely be helpful though it is not mandatory.

Installing Python

Python currently has 2 different versions in circulation. Python2 and Python3. Python comes pre-installed with Mac and Linux. However one needs to download and install it on windows systems. On my ubuntu system, you can see that both python2 and 3 are installed.

check python version

We will now be installing python on our windows systems and to do that, first, we need to download it. You can download Python3 from here.

You can then begin installing Python. No rocket science here. Just keep hitting next and accept wherever asked. Most default options work for everyone.

install python on windows

Just make sure you check the Add Python to PATH. This will add an environment variable that links to python binary. And we will click on Install Now.

The installer will ask for administrative privileges, be generous and give it away. You should get one more prompt asking you to disable the character length limit. Just accept it for now. Might again ask for administrator privileges.

python installation completed

If all goes well you will see a setup was a successful window and BAM you’re done. You have installed python.

Testing our Python Installation

You can now search for an application called IDLE. We will just write the following code in it to test if everything works. We are simply printing a statement with the print() function.

python cli 7.2

You can see that it does print out something we wanted it to. However, this isn’t how we intend to write our code. We will be dealing with a terminal or command prompt. To run the same thing on a terminal screen open your command prompt or terminal and type python to open a python prompt. Then you can type in the same print() function to receive output as follows.

python command prompt

Easy wasn’t it. But this still isn’t how we intend to write our code. We will write our code in a file and then run it from a terminal. You can choose any of your preferred text editor for the job. I am creating a file named theitstuff.py on my Desktop and simply writing one line of code inside it.

print("TheITStuff is an awesome website")

This will simply print out a line of text. Now to run this file, we can simply call the command python theitstuff.py. This will run the python code written in that file.

Note – All python files must have an extension of .py.

python project in windows command prompt

If you have followed everything up until now you should be able to reproduce a similar output as the image above.

Conclusion

Python is a very dynamic language that has a wide array of applications. We know how to install python and run scripts via the terminal. If you have any confusion regarding the installation, drop a comment and I’ll be there for you.

Learn PythonUncategorizedtutorial