Arry Rahmawan Destyanto

Python 101: A Beginner’s Guide

When I discovered that my PhD research and the Python programming language were inseparable, I panicked. I mean, I was completely clueless about what Python was and how to use it. Especially since, back when I was pursuing my bachelor’s and master’s degrees at the University of Indonesia, Python wasn’t really a familiar teaching tool yet.

But nowadays, if you’re an absolute beginner to Python, there’s no need to worry. There are tons of tutorials for beginners about Python available. Hopefully, what I’m sharing in this article can be an additional reference among the many Python tutorials for beginners that can now be easily found online. This article’s content comes from the notes I took when I first learned Python. I documented the essential things that anyone starting their Python journey should pay attention to, and here’s a summary of those notes.

I’ve divided this article into three parts to make it easier to read: Getting to Know Python, Understanding Python Versions, and Installing Python on Your Computer. Let’s go!

a. Getting to Know Python

Python is a popular, high-level, interpreted, and general-purpose programming language designed for readability and simplicity. Created by Guido van Rossum in the late 1980s, Python was first released in 1991. Guido van Rossum is from the Netherlands, and it’s such a coincidence that I’m doing my PhD in the Netherlands too. It feels like Python is a local product here that I must master, or at least become somewhat familiar with.

Over the years, it has grown in popularity and is now one of the most widely used programming languages worldwide. Python is versatile, with applications in various domains such as web development, data analysis, artificial intelligence, machine learning, scientific computing, and more. Its strengths lie in its clean syntax, ease of learning, vast standard library, and a thriving community that contributes to its growth and development.

The reason I’m focusing on Python and Pyomo in this optimization guide is that this programming language is incredibly powerful, free to access, and widely supported. One of the challenges of solving optimization problems is that we usually have to pay for expensive software. This also sometimes leaves me puzzled about how to teach optimization concepts to students when they don’t have the extra budget to buy the necessary software. With Python, that’s no longer an issue, as everyone (as long as they have a strong desire to learn) can access Python for free. I don’t even feel like I’m endorsing a specific paid software program, because Python is open source and free.

Now that we know why Python is the go-to choice for learning optimization, let’s dive into popular Python versions.

b. Python versions

Python has undergone several major version updates since its inception. Here’s a more detailed look at the two most significant versions: Python 2.x and Python 3.x.

  1. Python 2.x:

Python 2.x was the predominant version of Python for many years. The last release in this series, Python 2.7, included many features and improvements that made it a popular choice among developers. However, as Python evolved, some limitations and inconsistencies were identified, which led to the development of Python 3.x.

Python 2.x is no longer actively maintained, and its end-of-life was officially reached on January 1, 2020. While some older projects may still use Python 2.x, it is generally not recommended for new projects.

  1. Python 3.x:

Python 3.x is the current and actively maintained version of Python. It was first released in 2008, with a focus on fixing the limitations and inconsistencies present in Python 2.x. Python 3.x introduced many new features, improvements, and optimizations, such as:

While the transition from Python 2.x to Python 3.x involved some backward-incompatible changes, most developers have now migrated to Python 3.x, as it offers more robustness, security, and maintainability.

The last time I checked, the latest stable version of Python was Python 3.11. I remember when I first got acquainted with Python during my PhD, I downloaded Python 3.6. That means that in about 3 years, Python has evolved quite a bit. I recommend those of you who want to learn Python to use the latest Python version, as the newest version will undoubtedly have longer-lasting support and backing from the community.

c. Installing Python?

There are several ways to install Python on your computer, depending on your needs and preferences. Here are three common methods:

a. Python.org: You can download the latest Python version directly from the official website (https://www.python.org/downloads/). This method provides you with the most up-to-date version and is available for Windows, macOS, and Linux. I prefer this method because it’s lighter on my computer, makes calculations more responsive, and allows me to filter which Python packages I need to install on my computer based on my needs.

b. Anaconda Distribution: Anaconda is a popular distribution that includes Python, along with a large number of scientific computing and data analysis libraries, like NumPy, pandas, and scikit-learn. You can download the Anaconda distribution from their website (https://www.anaconda.com/products/distribution) and choose the Python 3.x version. The advantage of using Anaconda is that it comes pre-installed with a wide variety of Python packages, but of course, it requires more computer resources.

c. Package Managers: If you’re using a Linux-based operating system or macOS, you can also install Python using package managers like apt, yum, or Homebrew. Keep in mind that the version available through package managers might not be the latest one.

Once you have installed Python, you can verify your installation by opening a command prompt or terminal and typing python --version. This command will display the installed Python version.

Checking if Python is already installed on our computer system or not

Now that you have a basic understanding of Python’s history, versions, and installation options, you can proceed to learn more about Python programming concepts and tools, like variables, data types, control structures, functions, and more.

Exit mobile version