Practical – 146 : Install, set up the environment & run Python

Here’s a clear and step-by-step guide on how to install, set up the environment, and run Python on your computer:

1. Install Python

🔹 For Windows:

  1. Go to the official Python website: https://www.python.org
  2. Click Downloads and choose Windows.
  3. Download the latest version (e.g., Python 3.12).
  4. Run the installer.
  5. ✔️ Important: Check the box that says “Add Python to PATH” before clicking Install Now.
  6. Wait for the installation to complete.

 

2. Set Up Environment

  • Verify Python Installation:

python –version

or

python3 –version

3. Run Python Code

🔹 Using Command Line (Terminal):

python

Then type:

print(“Hello, Python!”)

🔹 Using a Python File:

  1. Open any text editor (like Notepad or VS Code).
  2. Save the file as hello.py.
  3. Write this code:
  4. print(“Hello, World!”)
  5. Run it in terminal:
  6. python hello.py