---
title: Python &amp; VS Code Setup (From Zero to a Professional Environment)
date: 2026-01-01T11:51:50Z
modified: 2026-01-03T16:04:15Z
permalink: "https://www.micheledpierri.com/python/setup/"
type: page
status: publish
excerpt: ""
wpid: 2454
featured_image: "https://www.micheledpierri.com/wp-content/uploads/2026/01/Python_02.webp"
featured_image_alt: Children dressed in lab coats are studying a python
timestamp: 2026-01-03T16:04:15Z
tags: []
---

## Lesson Objectives

By the end of this lesson, you will be able to:

- Install Python correctly on your system
- Configure Visual Studio Code as a professional Python IDE
- Run Python scripts from the terminal
- Understand how this setup scales to data analysis and machine learning

This lesson is **foundational**.

A poor environment setup will compromise everything that follows.

---

## 1️⃣ What Is Python (and Why We Use It)

Python is a **high-level, general-purpose programming language** designed to prioritize:

- readability
- expressiveness
- rapid development

Python is widely adopted in:

- scientific computing
- statistical analysis
- machine learning
- artificial intelligence
- automation and scripting

In this course, Python is **not an end in itself**.

It is the computational backbone for **advanced analytical workflows**.

---

## 2️⃣ Installing Python (The Correct Way)

### Step 1 — Download Python

Always download Python from the **official source**:

https://www.python.org
```
<span class="line"><span style="color: #F8F8F2">https:</span><span style="color: #FF79C6">//</span><span style="color: #F8F8F2">www.python.org</span></span>
<span class="line"></span>
```

Install **Python 3.10 or newer**.

> Avoid unofficial installers or OS-level package managers unless you know exactly what you are doing.

### Step 2 — Installation Options (Critical)

During installation:

✅ **Check the option**

Add Python to PATH
```
<span class="line"><span style="color: #F8F8F2">Add Python to </span><span style="color: #BD93F9">PATH</span></span>
<span class="line"></span>
```

**Do not skip this step**

Why this matters:

- The PATH variable allows your system to locate Python
- Without it, Python commands will fail silently or unpredictably

### Step 3 — Verify Installation

Open a terminal (Command Prompt / PowerShell / Terminal):

python --version
```
<span class="line"><span style="color: #F8F8F2">python </span><span style="color: #FF5555; font-style: italic; text-decoration: underline">--</span><span style="color: #F8F8F2">version</span></span>
<span class="line"></span>
```

Expected output:

Python 3.12.x
```
<span class="line"><span style="color: #F8F8F2">Python </span><span style="color: #BD93F9">3.12</span><span style="color: #F8F8F2">.x</span></span>
<span class="line"></span>
```

If this command fails, Python is **not properly installed**.

---

## 3️⃣ Installing Visual Studio Code

### Why Visual Studio Code?

Visual Studio Code (VS Code) is a **lightweight but professional-grade code editor**.

We use VS Code because it:

- scales from beginner to expert
- integrates seamlessly with Python
- supports debugging, linting, and testing
- is widely used in scientific and industrial contexts

### Step 1 — Download VS Code

Official website:

[https://code.visualstudio.com](https://code.visualstudio.com)

Install using default settings.

### Step 2 — Install Python Extensions

In VS Code → Extensions panel, install:

- **Python** (Microsoft)
- **Pylance**

These extensions provide:

- syntax highlighting
- intelligent autocomplete
- inline error detection
- type inference

This is essential when working with **complex analytical code** later.

---

## 4️⃣ Creating Your First Python Project

### Step 1 — Create a Project Folder

Create a folder, for example:

python_course
```
<span class="line"><span style="color: #F8F8F2">python_course</span></span>
<span class="line"></span>
```

Open it in VS Code:

File → Open Folder

```
<span class="line"><span style="color: #F8F8F2">File → Open Folder</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Step 2 — Create a Python File

Inside the folder, create:

lesson01.py
```
<span class="line"><span style="color: #F8F8F2">lesson01.py</span></span>
<span class="line"></span>
```

---

## 5️⃣Writing Your First Python Code

Insert the following code:

print("Hello, Python!")
```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">Hello, Python!</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
```

### Code Explanation (Line by Line)

- `print()` is a built-in Python function
- `"Hello, Python!"` is a string literal
- The function outputs the string to the console

Python is an **interpreted language**:

the code is executed line by line, without compilation.

---

## 6️⃣ Running the Script

### Option 1 — Terminal Execution (Recommended)

In the VS Code terminal:

python lesson01.py```
<span class="line"><span style="color: #F8F8F2">python lesson01.py</span></span>
```

Expected output:

Hello, Python!```
<span class="line"><span style="color: #F8F8F2">Hello, Python!</span></span>
```

### Option 2 — VS Code Run Button

You may also use the ▶ Run button.

Both approaches are valid, but **terminal execution builds better mental models** for later work.

---

## 7️⃣ Common Beginner Errors (and Why They Matter)

### Missing quotation marks

print(Hello)
```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(Hello)</span></span>
<span class="line"></span>
```

Error:

NameError: name 'Hello' is not defined
```
<span class="line"><span style="color: #8BE9FD; font-style: italic">NameError</span><span style="color: #F8F8F2">: name </span><span style="color: #E9F284">'</span><span style="color: #F1FA8C">Hello</span><span style="color: #E9F284">'</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">is</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">not</span><span style="color: #F8F8F2"> defined</span></span>
<span class="line"></span>
```

Explanation:

- Python interprets unquoted text as variable names

### Using typographic quotes

print(“Hello”)

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(“Hello”)</span></span>
<span class="line"></span>
<span class="line"></span>
```

Explanation:

- Python only accepts straight quotes (`"` or `'`)

### Forgetting to save the file

Always save before running.

---

## 8️⃣ How This Setup Scales to Advanced Python

This exact environment will later support:

- numerical libraries (`numpy`, `scipy`)
- data analysis (`pandas`)
- visualization (`matplotlib`, `seaborn`)
- machine learning (`scikit-learn`)
- reproducible research pipelines

You will **not need to change tools**, only add complexity.

---

## FAQ — Frequently Asked Questions

**Q: Why not start with Jupyter notebooks?**

A: Scripts teach execution flow and structure. Notebooks come later.

**Q: Should I install Anaconda?**

A: Not yet. Understanding the standard Python ecosystem first is critical.

**Q: Is Python suitable for serious scientific work?**

A: Yes. Most modern scientific pipelines rely on Python.

**Q: Will this work on Windows, macOS, and Linux?**

A: Yes. Python is cross-platform.

---

## Exercises 

### Exercise 1

Print your name.

### Exercise 2

Print your age.

### Exercise 3

Print two lines of text.

### Exercise 4

Print a sentence containing quotes.

### Exercise 5

Print a number.

### Exercise 6

Print the result of `10 + 5`.

### Exercise 7

Print a string and a number on the same line.

### Exercise 8

Use `\\n` to print text on two lines.

### Exercise 9

Modify the file and run it again.

### Exercise 10

Create a new file `test.py` and run it.

---

## Solutions

### Exercise 1

print("Michele")

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">Michele</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 2

print(42)

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #BD93F9">42</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 3

print("Line one")
print("Line two")

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">Line one</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">)</span></span>
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">Line two</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 4

print('He said "Python is powerful"')

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">'</span><span style="color: #F1FA8C">He said "Python is powerful"</span><span style="color: #E9F284">'</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 5

print(100)

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #BD93F9">100</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 6

print(10 + 5)

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #BD93F9">10</span><span style="color: #F8F8F2"> </span><span style="color: #FF79C6">+</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">5</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 7

print("Age:", 42)

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">Age:</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">, </span><span style="color: #BD93F9">42</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 8

print("First line\\nSecond line")

```
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">First line</span><span style="color: #FF79C6">\\</span><span style="color: #F1FA8C">nSecond line</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 9

# Save and re-run the file

```
<span class="line"><span style="color: #6272A4"># Save and re-run the file</span></span>
<span class="line"></span>
<span class="line"></span>
```

### Exercise 10

# test.py
print("This is a new file")

```
<span class="line"><span style="color: #6272A4"># test.py</span></span>
<span class="line"><span style="color: #8BE9FD">print</span><span style="color: #F8F8F2">(</span><span style="color: #E9F284">"</span><span style="color: #F1FA8C">This is a new file</span><span style="color: #E9F284">"</span><span style="color: #F8F8F2">)</span></span>
<span class="line"></span>
<span class="line"></span>
```

---

## Next Lesson Preview

In **Lesson 03**, we will cover:

- variables
- naming conventions
- Python syntax fundamentals
- how Python stores and manipulates data

## **This is where real programming begins.**