Python Day 1: Introduction

1. Install Python

To install Python, follow these steps:

- Download Python:
  - Go to the official Python website: python.org
  - Click on the latest version available for Windows.

- Run the Installer:
  - Double-click the downloaded installer (.exe).
  - Check the box that says "Add Python to PATH" before clicking "Install Now."

- Complete Installation:
  - Follow the prompts to finish the installation.

2. Configure Python in Environmental Variables on Windows

After installing Python, you may need to set up environmental variables to ensure it's accessible from any command prompt. Here’s how to do it:

- Open Environment Variables:
  - Right-click on "This PC" or "My Computer" and select "Properties."
  - Click on "Advanced system settings."
  - In the System Properties window, click the "Environment Variables" button.

- Edit the PATH Variable:
  - In the Environment Variables window, look for the "Path" variable in the "System variables" section and select it. Click "Edit."
  - Click "New" and add the path to your Python installation (e.g., C:\Python39 or C:\Users\\AppData\Local\Programs\Python\Python39).
  - Additionally, add the Scripts folder (e.g., C:\Users\\AppData\Local\Programs\Python\Python39\Scripts).
  - Click "OK" to save changes.

3. Access Python in Command Prompt (CMD)

You can access Python directly from the command line. Here’s how:

- Open Command Prompt:
  - Press Windows + R, type cmd, and hit Enter.

- Check Python Installation:
  - Type python --version and press Enter. You should see the installed Python version.
  - You can also start the Python interactive shell by typing python and pressing Enter. This will take you to the Python prompt (>>>).

4. Install/Uninstall Libraries

Python uses packages to extend its functionality. You can manage these packages using pip, which is included with Python. Here's how to install and uninstall libraries:

- Install a Library:
  - In the command prompt, type the following command to install a library (for example, requests):
    pip install requests

- Uninstall a Library:
  - To uninstall a library, use the following command:
    pip uninstall requests

- List Installed Libraries:
  - You can see a list of all installed libraries by running:
    pip list