🐍 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.
💾 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.
🛠 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.
📂 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!
🧠 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:
- Create a file named intro.py.
- Print your name.
- Print your age.
- Print your favorite food.
print() statements.
🚀 What’s Next?
In the next lesson, you’ll learn about:
- Variables
- Data types
- User input
- Storing information inside programs
Comments
Post a Comment