# Getting Python for the First Time
> Installing Python can feel confusing at first — there are many versions, distributions, and ways to set it up. If you’re new to Python/programming in general, this guide will walk you through the simplest way to install Python on your local machine.
[TOC]
## Python Programming Language
Just like many other programming languages, Python is used to write scripts or programs that can be executed by an interpreter to do things we human don't wanna do or can't do.
An interpreter is a program that reads and executes code. For Python, the interpreter reads the code line by line and translates it into a form that the computer can understand. This is different from compiled languages (like C or C++), where the whole program is translated into machine code before execution.
> think about it as a engine for running Python on a machine.
## Installation
> How to download and install python?
:::info
You may install Python in various ways, depending on your operating system and personal preferences. Python can be downloaded from the official website or managed via package managers like `brew` on Mac or `pyenv`.
:::
:::warning
While tools like [Anaconda](https://www.anaconda.com/) provide Python pre-installed along with many useful (but large & heavy) libraries, it's not recommended for beginners to install Anaconda unless specifically needed, as it introduces additional complexity.
:::
### Download Python from official site
> It might not be the best way, but in many ways, this is the most straightforward.
Go [here](https://www.python.org/downloads/), download the latest (or newer) **stable** version of Python and install it.

:::warning
For **Windows**, if you know nothing about programming, it's recommend to check the "Add Python 3.x to PATH" option during installation. This allows you to run Python from any command prompt or terminal without additional configuration.

:::
### Check whether Python is successfully installed
Find the python `IDLE` app in your machine.
If there is one, then you are good to go.
| Windows | MacOS |
| --- | --- |
|  |  |
## Writing Python
How do your machines know it's a Python file?
A file of any code is simply a text file with different extension: (so, fear not)
- C++ file with `.cpp` extension
- Python file with a `.py` extension

:::warning
Some of you may have heard about or used Jupyter Notebook or Google Colab to write Python code (`.ipynb`). While these tools are excellent for experimenting and running Python code interactively, please note that they **cannot be used for submitting homework or assignments** in this course.
:::
:::info
All homework submissions must be in the form of a `.py` file, which is a standard Python script. This ensures consistency and allows TAs to test and run your code efficiently.
:::
### Text Editor
Programmers write code in text editor. You can choose any editor that you prefer:
- IDLE (comes with the Python installation)
- Visual Studio Code (most popular, requires minimal configuration)
- Pycharm (works out of the box, for Python only)
- ...
:::spoiler
:x: you must not use MS Word :)
<iframe width="560" height="315" src="https://www.youtube.com/embed/X34ZmkeZDos?si=NuuTQ4_9itu_wbkz" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
:::
## Words
- [Coding 是想像的世界](/4faeAXNmRpCpmz4w5Vk9-g)
## !IMPORTANT
> In programming, `!` often represents "not," so this could be read as "not important".
<img src="https://hackmd.io/_uploads/r1X1ebvn0" width="350" height="350"/>
<img src="https://hackmd.io/_uploads/S13Ky-v3R.png" width="350" height="350"/>
<iframe width="560" height="315" src="https://www.youtube.com/embed/8D7FZoQ-z20?si=voPI_LdLkyP-_ahy" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/x7X9w_GIm1s?si=SrtHRXFHqXqDOPto" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>