🐍 Lesson 2: Install Python & Set Up Your Coding Environment

Welcome back! In this lesson, you’ll learn how to install Python, choose a code editor, and run your very first real Python program stored inside a file. By the end of this lesson, your computer will be fully ready for Python development.


⭐ What You Will Learn in This Lesson

  • How to download and install Python correctly
  • How to choose a beginner-friendly code editor
  • How to create and run your first Python file
  • How to use the terminal/command prompt

👥 Who Is This Lesson For?

  • Complete beginners setting up Python for the first time
  • Students using Windows, Mac, or Linux
  • Anyone unsure how to run Python files
  • People reinstalling Python or switching computers

⬇️ Step 1: Download Python

Download Python from the official website:

👉 https://www.python.org/downloads/

Select the latest version (Python 3.x) and click Download.

Tip: Always choose Python 3.x — Python 2 is outdated and no longer supported.

💾 Step 2: Install Python

Once the installer opens, make sure to check this option:

  • Add Python to PATH ✔

This ensures you can run Python from the terminal.

Now click Install Now.

Mac & Linux Users: Python may come pre-installed, but it’s still recommended to install the latest version from the website.

Common Mistake: Forgetting to check Add Python to PATH. If Python doesn't run in terminal, this is usually why.

🛠 Step 3: Install a Code Editor

You need a place to write Python programs. Here are the most popular editors:

  • VS Code — Best for beginners & professionals
  • PyCharm — Great for large Python projects
  • Thonny — Simple, small, and beginner-friendly

Recommended: VS Code — lightweight, powerful, and easy to use.

Note: If using VS Code, install the Python extension for best experience.

📂 Step 4: Create Your First Python File

Open your editor and create a new file named:

hello.py

Inside it, write:


print("Hello from my Python file!")

This is your first Python script stored inside a real file.


▶️ Step 5: Run the Python File

✔ On Windows / Mac / Linux (using terminal)

python hello.py

✔ On Mac (sometimes)

python3 hello.py

You should see this output:

Hello from my Python file!
If you see an error saying “python not found,” it means Python was not added to PATH. You may need to reinstall it.

🧠 What Just Happened?

You wrote your first real Python program inside a file. When you run the file:

  • Python reads the file line by line
  • Executes the code inside it
  • Prints the output to your terminal

From now on, you'll write and run Python scripts this way — just like real developers.


❌ Common Mistakes

  • Forgetting to check "Add Python to PATH"
  • Saving the file as hello.txt instead of hello.py
  • Using python3 instead of python (or vice versa)
  • Not opening the terminal in the same folder as the file

❓ Frequently Asked Questions (FAQ)

1. Do I need a strong PC for Python?

No. Python runs on almost any computer — even older ones.

2. Can I use mobile apps like Pydroid or Termux?

Yes, but a computer is recommended for serious learning.

3. Is VS Code free?

Yes, completely free and widely used by developers.

4. Why does my terminal show “python not recognized”?

Because Python wasn’t added to PATH during installation.


🧪 Practice

Try these exercises to build confidence:

  1. Create a file named intro.py.
  2. Print your name.
  3. Print your age.
  4. Print your favorite food.
Bonus: Try printing all three on separate lines using multiple print() statements.

🚀 What’s Next?

In the next lesson, you’ll learn about:

  • Variables
  • Data types
  • User input
  • Storing information inside programs

➡ Next Lesson

Go to Lesson 3 →

Comments

Popular posts from this blog

How to Install Geany 2.1 on Windows 10/11 (2026) | Step-by-Step Guide

How to Uninstall Bluefish 2.2.19 on Windows 10/11 (2026) | Step-by-Step Guide

How to Install Visual Studio 2026 on Windows 10/11 | Step-by-Step Guide