Python Intro & Installation
Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum and first released in 1991. It emphasizes code readability and clean syntax, enabling developers to write logical code for small- and large-scale projects.
Why Learn Python?
- Readable and Clean: Python's syntax closely resembles natural English, making it intuitive to read and write.
- Interpreted: Code is executed line-by-line, which simplifies testing and debugging.
- Cross-Platform: Works seamlessly across Windows, macOS, Linux, and Unix systems.
- Extensive Ecosystem: Large standard library and third-party package repository (PyPI) for web development, data science, automation, machine learning, and scripting.
Step-by-Step Installation Guide
Download the Installer: Official Release Source.
Navigate to the official website at python.org/downloads and download the latest stable release for your operating system (Windows, macOS, or Linux).Run Installation (Critical PATH Step): Windows Prerequisite.
Launch the downloaded installer. On Windows, ensure you check the box that says "Add python.exe to PATH" before clicking Install Now. Checking this box enables running Python directly from any terminal prompt.Verify the Installation: Terminal Check.
Open your terminal (Command Prompt/PowerShell on Windows, or Terminal on macOS/Linux) and verify Python is active by checking its version:
python --version
# or on macOS/Linux systems:
python3 --version
- Run Your First Python Code: Interactive REPL or Script.
Option 1: Interactive REPL
Type python or python3 in your terminal to start the interactive interpreter, then execute:
print("Hello, World!")
Exit using exit() or Ctrl+Z (Windows) / Ctrl+D (macOS/Linux).
Option 2: Script File
Create a file named hello.py with your editor containing print("Hello, World!") and run it:
python hello.py