> For the complete documentation index, see [llms.txt](https://glory-to-arstotzka.gitbook.io/python-tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://glory-to-arstotzka.gitbook.io/python-tutorial/master.md).

# Introduction to Python

**NOTE : The tutorial assumes you know how to do intermediate computer stuff** \
**I never used a Mac and I don't usually use Linux, so feel free to ask google what I didn't cover.**

## Important credits before we begin

This tutorial was made with the intent of teaching people python, share it as you will , but remember that the author's discord is `[REDACTED]`  and feel free to ask me questions. **Cheers for reading**

UPDATE: This tutorial was originally wrote in 2017. In august 2025 I decided to update it to fix grammatical mistakes and informational mistakes. I decided to keep it since I believe it is still beginner friendly and I want to pursue a bit more the path of making tutorials.

## Why Python?

Short answer : because it's easy and it can do a **LOT** of things even when if other languages can do a lot of things easier

{% hint style="info" %}
Python is the BEST language currently for machine learning
{% endhint %}

## Python Versions

As the time of updating this, python 3.14 is in pre-release. Stick to the latest stable version, or 1-2 versions behind if using certain libraries and need compatibility. I personally run 3.11 a lot

## Gettin' started

To use python we'll have to install it. We'll install 3.13 (or whichever is latest)

### Installation process \[Windows]

The installation is pretty straightforward : go to <https://www.python.org/downloads/windows/> then get any 3.13 version using the **executable installer** or **web-based installer**. Both are good (executable comes with all the downloadable files, web-based instead downloads python files only when you run the installer)

{% hint style="info" %}
If you have 32 bit windows , take the **Windows x86** instead of **Windows x86-64**
{% endhint %}

After you download it , just run it and check the option "**Add Python 3.13 to PATH"** (This will make this python the system default python and it will help us later when we are going to install packages)<br>

### Installation Process \[Mac and Linux]

#### Mac installation

On mac: <https://www.python.org/downloads/mac-osx/> The process is really straightfoward and if you have **32 bit** OS , get the **32 bit** version \[*same* for **64 bit**] If you don't know if you have **32bit** or **64bit** just read this : <https://apple.stackexchange.com/questions/12666/how-to-check-whether-my-intel-based-mac-is-32-bit-or-64-bit> (or a newer post)

#### Linux installation

Linux usually comes with the python installed and you can check it by typing :

```
python3 --version
```

For the purpose of this tutorial, it can be any version, but to get 3.13 specifically you can do

```
sudo apt-get update
sudo apt-get install python3.13
```

on **Fedora** the command should be  `sudo yum install python3.13`

### First Lines in Python

Writing python code right now can be pretty messy since you have no **IDE**. Will explain later what an IDE is\
For now, make a folder where you will store all your python files, then make a *text document* (**name doesn't matter)** . Click on the '**FILE'** button then click on '**SAVE AS'** after that, a window will pop-up and will ask you where to put it , the folder the text document is in should already be selected. Now all you have to do is to change the type of the file by clicking on the '**Text documents (\*.txt)**' and then choosing '**ALL FILES'**\
\
Then you will have to add **.py** to the file name so it will become a python file, then just save it.

{% hint style="warning" %}
I don't know the exact way of doing this on Mac or Linux , but you basically have to get a random blank file then save it with the **.py** extension and that's all
{% endhint %}

Now to open up the default editor that comes with the python installation (on windows at least): just right click the **.py** file then one of the first options will be '**edit with IDLE**' and then choose the **64 bit** option if you have it (otherwise choose **32 bit** option)

{% hint style="info" %}
On Linux you should have a program called TEXT EDITOR that can be used as IDLE for this task \
On Mac you should have a program called TextEdit that can be used as IDLE&#x20;
{% endhint %}

Any code that you will put in this file (*that was opened trough IDLE)* will require **CTRL+S** to save and **F5** to run *ANYTHING* that you will write there.

{% hint style="info" %}
Try to write the code from the tutorial without copy pasting because it helps you to memorize the syntax and understand it better
{% endhint %}

Now type there `print("Oh hi Mark")`, then just press **CTRL+S** to save it and **F5** to run it. \
As you can see a shell poped out and it said some basic system info and then it ran the **script** in a **SHELL**&#x20;

{% hint style="success" %}
Good job! You've just created a program that will output "**Oh hi Mark**" every time it's being run.
{% endhint %}

#### Practice makes perfect

Now before continuing try to put other words in the print function and try to get it running (I suggest the word **'word')**

{% hint style="warning" %}
If you get a syntax error after rewriting and running , try to see what you did different and don't worry if it is confusing right now, we will talk about the **PRINT** function soon
{% endhint %}

{% hint style="success" %}
If you practiced as it was before asked , you can now proceed to the next tutorial and keep up the good work!
{% endhint %}
