smartyfy.mrindigi.com

002. Installing Python & Setting Up the Environment

LESSON 002 · PYTHON FOUNDATIONS

Installing Python & Setting Up the Environment

Build a clean professional Python workspace, verify the interpreter, understand the terminal, and run your first local script.

Learning outcomes

By the end of this lesson you can identify the Python interpreter, verify a Python installation, understand PATH, choose an editor, create a project folder, and run a .py file from a terminal.

1. Python interpreter

Python source code is stored in files ending in .py. The Python interpreter reads and executes those instructions. On many systems you can check the installed version with:

python --version
# or on some systems
python3 --version

A successful result displays a Python 3 version. Modern learning projects should use Python 3 rather than legacy Python 2.

2. Editor and project workspace

A code editor gives you syntax highlighting, file navigation, search, terminal access and debugging support. Create a folder named smartyfy-python, then create lesson02.py inside it.

print("Python environment is ready!")
print("Welcome to Smartyfy Lesson 2")

Run it from the terminal with python lesson02.py or python3 lesson02.py.

▶ Try it now

Use the browser Python runner from Lesson 1 while setting up your local environment. Run this program and compare its output with your local terminal.

import sys
print("Python is working")
print("Version:", sys.version.split()[0])
print("Executable environment ready")
Expected result: Python is working, followed by the active Python version.

Hands-on challenge

  1. Create a project folder.
  2. Create profile.py.
  3. Print your name, course name and Python version.
  4. Run the file from a terminal.
  5. Intentionally misspell print, observe the error, then fix it.

Knowledge check

  1. What is the role of the Python interpreter?
  2. What does PATH help the operating system find?
  3. What extension is normally used for Python source files?
  4. How do you check your installed Python version?
Mastery target: create and run a Python file without assistance.
← 001. Introduction003. Your First Python Program →