It just might be the holy grail of programming languages.
But actually, it was in fact named after Monty Python, the British surreal comedy group. Python was first released by Guido van Rossum in 1991, and at the time he was reading the published scripts from the series “Monty Python’s Flying Circus.”
What is Python used for?
Python is seen as a universal language and used for a variety of things, from automating simple tasks to building full-blown web applications. Python is the favored high-level programming language for companies such as Instagram, YouTube, Reddit, Google, Netflix, and many more. Even NASA uses Python to program their equipment.
What is Python?
Python is an all-purpose programming language that works on multiple platforms. It’s a relatively simple language that is preferred by many experienced software developers to code something when the language doesn’t particularly matter. Python is typically the first language programmers learn because of its perceived ease-of-use and readability, plus there’s a lot of helpful documentation available from a large community.
Python is an interpreted language, also referred to as a scripting language. This just means that the written code isn’t converted to a computer-readable format when a program runs. Most other programming languages are translated before runtime.
Python can be used for a lot of different things other than just building applications. Take web scraping for example. However, Python is commonly used for machine learning and predictive modeling. The general language can solve mathematical equations and save data, making it especially useful for academics and data scientists.
Why you should learn Python
First and foremost, Python is open source and free to learn. It closely resembles the English language in order to emphasize readability. Python is the fourth most-used programming language, a rating that is highly attributed to its accessibility and ease-of-use.
The languages has a set of rules known as PEP 8. This style guide levels the playing field for novice and expert Python developers, which means that every script will be easy to read and look fairly similar.
TIP: Check out our analysis on PHP vs Python – which is better and why.
Using basic Python syntax
Syntax refers to the set of rules mentioned above. Let’s create and run a simple Python script using the basic print command. Before we start, make sure to download the latest version of Python (Python 3.7.3 as of this article’s publish date) from https://www.python.org.
Note: I’m using a Mac for this example. The sample code will be the same on a Windows or Linux but the applications used may vary.
Open the Terminal application, or Command Prompt on Windows, and type “python” and press enter. This will open an interactive prompt, which allows you to write one line of Python at a time. Slow and steady.
Now, next to the cursor, type “print(‘Hello World!’)” and press enter. You can see that it prints that exact phrase on the next line. In this example, ‘Hello World!’ is called a string and print is a python command that tells the code to write out the text string within the quotes.
Congrats, you just ran your very first Python script! Bonus round: you can also set variables using Python. To do this, type “x = 10” and press enter. On the next line, type “print(x)” and press enter.
You can see that it prints the number 10, just as you commanded it to with your script. Now, every time you reference “x” in your code it will assign it the value of 10.
These are very basic Python scripts. Of course, there are more advanced rules for Python. For example, the indentation in a Python script is very important because it indicates a block of code. Python also has the capability to house in-code documentation called comments. You can quickly spot them because all comments start with a #. Again, the Python programming language really focuses on readability.
How to choose a Python IDE
While the Terminal window we used above is not a traditional text editor, it does act as one in this case. A free text editor is a tool that allows you to write code. Taking it a step further, an integrated development environment (IDE) is a tool that allows you to write the code, compile frameworks and/or library elements to build off of, and even debug it.
Most Python IDEs are built to work with specific application platforms, used by development teams to build software, apps, web pages, and other services. Believe it or not, some of these tools even have the capability to complete code automatically.
Bridget Poetker is a former senior content marketing specialist at G2, who focused on app development and design. Born and raised in the Chicago area, she graduated from the University of Illinois at Urbana-Champaign. I-L-L! In her free time, you'll find Bridget in the bleachers at Wrigley Field or posted up at the nearest rooftop patio. During the 8 months of Chicago winter, she hibernates. (she/her/hers)