logo

Ziffur

Getting Started with Python: A Minimal Set-up Guide

Getting Started with Python: A Minimal Set-up Guide

5 July 2021

Want to keep reading without running any code yourself? Feel free to skip ahead to the next article.

One of Python's strengths as a programming language is its intuitive syntax, making it easy and predictable for beginners to read and play around with. As with many other programming languages, though, getting set up to write your first line of code can be a frustrating challenge.

This guide is written with the intention of getting you started with Python code as smoothly as possible. To do so, we have two options for running Python:

  • In the browser (recommended on Windows)
  • Using a local installation

In the Browser

Skip all the downloading and installation wizards and start running Python code right now. There's a number of websites where you can do this, we recommend this one:

https://www.programiz.com/python-programming/online-compiler/

You should see a Python source code file on the left (main.py) and an interactive shell on the right. In the interactive shell, you can play around with variables and data types as we demonstrated in the previous article. In the source code file, main.py, you can do the same but in order to see the output in the console on the right, you need to use the print() function as shown. This function will display any data type you give to it and will also accept variables.

The next article will cover functions in detail and will also provide some examples for you to run and edit. Once you start to get comfortable with Python's syntax and features in the browser, you may want to install it on your computer anyway to unlock all its features.

Using a Local Installation

Once we have python installed locally on your computer, you can simply open a shell program and start programming!

Linux/Mac OS

If you have a unix-based operating system (Mac or Linux), lucky you! Python should come with your operating system out-of-the-box. To start running it, open a terminal window, enter python at the prompt and hit return. It should look something like this:

johndoe@johndoe-ThinkPad-T490s:~$ python
Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

That's it, you're ready to go! Refer to the previous article for examples of how you can play around with this. To get out of the python shell when you're finished, use ctrl+D or type in exit() at the prompt.

Windows

To install Python on Windows, download the installer from python.org/downloads/. Run it and click through the installation wizard to finish your installation.

Once your installation is ready, open a shell window (either Command Prompt or PowerShell). At the prompt, type in python and hit return. The output should look something like this:

C:\Users\JohnDoe> python
Python 3.8.5 (default, Jan 27 2021, 15:41:15) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 

You are now ready to write some real code! Continue to the next article to learn how.

Tags

Computer Science
Programming