# Introduction to Python — Install, First Program and How It Runs

Source: https://skills101.in/learn/python/python-introduction — Skills101 free tutorial (Python Programming). Updated 2026-11-09.

**Python** is a programming language that reads almost like English. It is the first language at many colleges, and companies use it for websites, data analysis, AI, automation and testing.

Why beginners love it:

- **Short code.** A task that needs 10 lines in Java often needs 3 in Python.
- **Easy to read.** Indentation (spaces) shows the structure — no curly braces.
- **Huge library.** Ready-made code for almost anything: `math`, `datetime`, web, AI.

## 1. How Python runs your code

![Your file hello.py goes to the Python interpreter, which runs it line by line and shows the output](https://skills101.in/learn-img/python/how-python-runs.svg)

Python is **interpreted**: the Python program reads your file **top to bottom, one line at a time**, and runs it. If a line has an error, it stops at that line and prints an error message telling you the line number.

## 2. Install Python (Windows)

1. Go to **python.org → Downloads** and download the latest Python 3.
2. Run the installer and **tick "Add python.exe to PATH"** (very important).
3. Open **Command Prompt** and type `python --version`. You should see something like `Python 3.12.1`.

You can also practise without installing anything: Skills101's [coding problems](https://skills101.in/practice/code) run Python in the browser.

## 3. Your first program

Create a file `hello.py` with this line, then run `python hello.py` in the terminal:

```python
print("Hello, Skills101!")
```

```text
Hello, Skills101!
```

`print()` shows whatever you put inside the brackets. Text must be inside quotes (single `'…'` or double `"…"`, both work).

### Printing several things

```python
print("Name:", "Asha")
print("Marks:", 92)
print(10 + 5)
```

```text
Name: Asha
Marks: 92
15
```

`print` puts a **space** between items separated by commas, and moves to a new line at the end.

## 4. Comments

Lines starting with `#` are **comments** — Python ignores them. Use them to explain *why* your code does something.

```python
# Calculate the total price with 18% GST
price = 500
total = price * 1.18   # GST added
print(total)
```

```text
590.0
```

## 5. Indentation matters

Python uses **4 spaces** at the start of a line to show that it belongs to a block (you will see this with `if`, loops and functions). Wrong indentation is an error:

```python
if 5 > 3:
    print("Five is bigger")
```

```text
Five is bigger
```

If you forget the spaces before `print`, Python stops with an **IndentationError**.

## 6. Reading error messages

Errors are normal — every programmer sees them daily. Read the **last line** first: it says what went wrong (`NameError`, `SyntaxError`, `IndentationError`), and the line above it shows **where**.

## Common mistakes

- Not ticking **Add to PATH** during installation, so `python` is "not recognized".
- Forgetting quotes around text: `print(Hello)` → NameError.
- Mixing tabs and spaces for indentation. Use 4 spaces.

## Quick recap

- Python runs your file top to bottom, line by line.
- `print()` shows output; text goes in quotes.
- `#` starts a comment.
- Indentation (4 spaces) defines blocks.
- Read the last line of an error message first.


Practice quiz and free certificate: https://skills101.in/learn/python/python-introduction