What is Python?
Tags: python, computerscience
Published: 2020-09-14 03:43:16

Hello! This week I'll be giving a brief introduction to the programming language Python!

Python was created by [Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum) and released in 1991. It was a successor to the [ABC](https://en.wikipedia.org/wiki/ABC_(programming_language)) programming language which Rossum was also involved in creating. Python was originally started as a hobby to keep Guido busy during a Christmas vacation and has evolved to be one of the most popular languages used today. The mysterious name is a homage to 'Monty Python's Flying Circus'!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2qsrndupg7mff6nlj2fw.jpg)

According to [Geeks for Geeks](https://www.geeksforgeeks.org/history-of-python/), Python "was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code." Python is more akin to the English language than other programming languages are. It is also similar to the mathematics language. 

Python is commonly used for server-side web development. It is also used for software development, mathematics, machine-learning, and system scripting. It can run on all the different popular platforms. Python runs on it's own interpreter system, so code can be quickly executed as soon as it's written.

A couple key differences when dealing with Python from other languages is it's use of a new line to complete commands instead of parentheses or a semi-colon, and Python uses indentation(white-space) to define scope.

To use Python you will need to check if it's installed. This can  be done by running this command in your terminal: python3 --version. You may have an older version of Python installed so you may need to run python --version or python2 --version but python3 worked for me. You can go to the Python [website](https://www.python.org/) if you need to install it. According to [W3Schools "Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed."](https://www.w3schools.com/python/python_getstarted.asp) So to run a file you need to prefix the 'your-file-name'.py file you want to run with the 'python3' command so the file will be supplied to the correct interpreter. Let's look at an example: 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lkx20oti2k1zvvteait4.png)

Here is a simple Python command that 'prints' a string to the console. Now this command to run the file:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zag1mcn3nxyntfdl7vo9.png)

since the name of the interpreter is python3 and the file to be run is demo.py. The result of the 'print' command is shown in the console. This is similar to calling 'console.log()' in JavaScript.

Python also has its own command line and you can access it by typing the interpreter name in the console, in this case 'python3'. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0svpijom9daruakl5bvv.png)

You can then run commands simply from the command line instead of creating a whole file, which makes testing code much easier.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/r2ix16oabokeu5eqvqm5.png)

As mentioned earlier, indentation is really important in Python because it establishes a code block. If you try to write a block of code without indentation, an error will occur. The amount of whitespace used needs to be at least one and if multiple lines are used inside the code block, the indentation must match. This is in contrast to JavaScript where whitespace is used only for easy reading.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5j9jbzx95vg0dmqw8ppd.png)

In Python, to create a variable you just need to assign a value to it and there are no variable declarations. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5sloz3bnlgtrh18wz93j.png)

Python supports commenting but instead of the forward slash(/) the pound sign(#) is used. There are no multi-line comments so each commented line must begin with a pound sign. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1354ryr5kd82sb8dncz1.png)

Here only 'No they definitely don't say 'Ni' gets printed to the console.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/aldebj2mxzqthth7hk9n.png)

In conclusion, Python is a programming language that was built to make programming easier and more intuitive than some of the other languages out there. Its supported by all the major platforms and is very popular! Thanks for reading!