Python Programming Language and Installation Guide

Jul 28, 2024

Notes on Programming Languages and Python Installation

Introduction to Programming Languages

  • In a competitive world, continuous skill upgrade is essential.
  • Computer programming is a versatile skill applicable across various fields.
  • A computer is an electronic device that collects, stores, and processes information based on given instructions, yielding useful results as output.
  • Instructions given to a computer are referred to as programs.
  • A programmer is someone who writes these instructions using a programming language.

Types of Programming Languages

  • Programming languages can be divided into three main categories:
    • Low-Level Language
    • High-Level Language
    • Middle-Level Language

Low-Level Language

  • Close to the computer's instruction set, easily understandable by the processor.
  • Further divided into:
    1. Machine Language
      • The native language of the computer, consisting of binary code (0s and 1s).
      • Fast for computer execution but challenging for programmers.
    2. Assembly Language
      • More readable than machine language and uses symbolic representations instead of binary.
      • Requires an assembler to convert to machine language.
      • Machine dependent, not portable.

High-Level Language

  • Easier for humans to read, write, and maintain.
  • Examples: Python, Java, JavaScript.
  • Translated to machine language using a compiler or interpreter.
  • Machine independent and portable.

Middle-Level Language

  • Known as Intermediate Language.
  • Combines features from both low-level and high-level languages.
  • Examples: C, C++.

Introduction to Python

  • Python is a high-level, versatile, and in-demand programming language, applicable in:
    • Web development
    • Data analysis
    • Artificial intelligence
    • Automation
    • Machine learning
    • Game development
  • Creator: Guido van Rossum, released in 1991.
  • Named after the show Monty Python's Flying Circus.

Reasons to Learn Python

  1. Popular and in-demand programming language, leading to job opportunities and salary hikes.
  2. Beginner-friendly with clean, expressive syntax resembling English.
  3. Cross-platform compatibility: works on Linux, Windows, and Mac OS.
  4. Versatile use for both simple and complex tasks.
  5. Vibrant, active community for support and assistance.

Downloading and Installing Python on Windows

Methods to Install Python

  1. From the Microsoft App Store:
    • Open command prompt and type python version. If not installed, it prompts to install from Microsoft Store.
    • Click the "Get" button for the latest version (e.g., Python 3.12).
  2. From the Official Python Website:
    • First, disable app execution aliases via Settings -> Manage App Execution Aliases.
    • Visit python.org, go to Downloads, and select the latest version.
    • Download executable and follow installation instructions.
    • Ensure to add Python to your system PATH during installation.

Running Python Programs

Modes of Running Python Programs

  1. Interactive Mode:

    • Start Python from the command prompt using python command.
    • Allows immediate execution of Python commands.
  2. Script Mode:

    • Write Python code in a .py file.
    • Open command prompt, change directory with cd to where the file is saved, and run with python filename.py.
    • Handle spaces in filenames with double quotes.
    • Redirect output to a text file using python filename.py > output.txt.

Using IDLE for Python

  • Launch IDLE through Start Menu to run Python in interactive or script modes.
  • Configure IDLE settings like font size, themes, and shortcut keys.

Configuring Python IDE (IDLE)

  • IDLE: Integrated Development and Learning Environment; part of the standard Python distribution.
  • Key features for customization include:
    • Change font style/size.
    • Use different highlighting themes or create custom themes.
    • Set key bindings for shortcuts.
    • Windows preferences for startup display.
    • Editor preferences for auto-squeeze and prompt settings.

  • Conclusion: This session covers the key aspects of programming languages, particularly focusing on Python. Continuous learning in programming is vital in today’s tech-oriented landscape. Follow the steps for installation and practice programming efficiently using the tools discussed.