Technical Article

Python Tutorial Part 1 | What is Python and Where do I Start?

May 15, 2024 by Michael Levanduski

An introduction to the popular Python language and how to take the first step in learning programming. In this article, learn how to obtain the proper IDE and executable for your OS.

Python is, at present, one of the most popular programming languages in the world. In a 2023 developer survey by Stackoverflow, Python ranked as the 4th most popular programming language among professional developers. Even more remarkable, Python placed first with developers classified as “Other Coders” at a whopping 64.79%.

 

Survey of language comparison

Figure 1. Stackoverflow survey results on programming languages. Image used courtesy of Stackoverflow

 

What Is Python?

Even in the ever-changing software landscape, Python will likely remain a top contender due to its versatility and low barrier to entry. The syntax is intuitive and easy to learn for beginners. The language is also not compiled like C and is instead interpreted. What this means is that Python code is executed by the interpreter and not the CPU in the laptop or server running the code. It forgoes a compilation step to binary code consisting of 1’s and 0’s, optimized for machine readability. As you may imagine, code consisting exclusively of 1’s and 0’s would not be very helpful to a human set of eyes reading it through. Thus, the lack of the compilation step in Python speeds up the development and testing process, while also providing immediate feedback in the debugging/troubleshooting process.

 

What Differentiates Python?

Python stands out from other programming languages in its sheer versatility. It can be used across a wide range of industries for a variety of tasks, including robotics, data analysis, machine learning, automation tasks, server-side web development, and maker applications, just to name a few.

In contrast, other popular languages, such as C, are very good at specific domains. For example with C, it is very good for game development or embedded systems applications but not great for data analysis. The benefit offered by Python’s versatility is less time and cost associated with transferring a developer's skills across multiple domains. The developer would not need to learn an entirely new language to accomplish an objective across domains.

If you are new to programming, Python is a great starting point since you may try out many different industry applications of the software to determine which domain is a good personal fit for your interests.

 

Python logo

Figure 2. Python logo. Image used courtesy of Python Foundation

 

Local Environment Setup

To get started with Python, you could simply start writing Python code in a text editor, such as Notepad++. However, this would be an exceptionally painful development experience and may lead to more human syntax errors due to the barebone features of a text editor. As a result, many developers use Integrated Development Environments, or IDEs, to make the development process much easier.

An IDE is usually an application containing tools and features within a user interface that provide developers with a slight aid while programming. IDEs are not exclusive to the Python language, they exist for a multitude of programming languages. Most have syntax checkers called linters and a file navigator at the simplest level. Some common IDEs for Python include Visual Studio Code (VS Code) and PyCharm.

 

VS Code Installation

To install VS Code, simply navigate to the projects download page. Select the appropriate download for your operating system type:

 

VS Code download image

Figure 3. VS Code download page. Image used courtesy of VS Code

 

PyCharm Installation

Installing PyCharm is simple, but please be mindful of the licensing. There is a free community version perfect for students and a professional paid version. Please choose the correct version for how you intend to use the license. For education purposes, the community version can be accessed from the downloads page. (I will assume no liability for misuse of the community version of the PyCharm IDE; please consult PyCharm’s licensing agreement)

 

PyCharm download image

Figure 4. PyCharm version options. Image used courtesy of PyCharm

 

Installing the Python.exe Interpreter

The second step in successfully getting started is installating the Python interpreter, the purpose of which is to translate the written code into machine-executable instructions. The interpreter is an executable that is stored in the file system of your local laptop. The Python.exe executable is managed by the Python foundation, where we can find the latest stable build. On a Windows machine, click on the download button and run the installation manager.

 

Python executable for Windows

Figure 5. Python download from the Python Foundation website. Image used courtesy of Python Foundation

 

Within the installation manager, be sure to check the "Add Python to PATH" option. Once complete, you can verify a successful install using a powershell or command prompt command below:

python --version

 

For Mac, the process should be the same except the file type is a .pkg and not a .exe. The latest build for macOS can be found at the same Python Foundation link.

 

Python executable for macOS

Figure 6. Python macOS download from the Python Foundation website. Image used courtesy of the Python Foundation

 

Again, be sure to check the "Add Python to PATH" option during installation. Upon completion, open a new zsh terminal and run the same command as with the Windows install:

python --version

 

On macOS, python is not installed at the system level, but rather in a user directory. If you are curious about where it is installed, you may run the following command:

which python3

 

This will likely yield a directory similar to /usr/bin as below:

 

Python executable file location

Figure 7. Python executable location in macOS file system. Image used courtesy of the author

 

Next Steps

With the local environment setup now completed, we can now begin to get our hands on the keyboard with the Python programming language. In the following articles (forthcoming), we’ll cover a few of the more foundational programming concepts.