Checking your session…
Module 01: Programming Fundamentals & Python Basics

Python Basics

Level: 1 | Version: v1.0 | Author: Meptrasoft

Every programmer starts with the basics. This module explains what Python is, how to set it up on your computer, how code is written, and how basic syntax rules work.

PYTHON
print("Welcome to Python Programming!")

Output:

TEXT
Welcome to Python Programming!

Getting Started

Introduction to Python

Python is a high-level, general-purpose programming language designed to be easy to read and write.

"High-level" means Python handles many hardware details automatically, so you can focus on solving your problem.

PYTHON
print("Hello, Student!")

Output:

TEXT
Hello, Student!

In Python, a single print() statement displays text on the screen without needing complex setup code. This is why Python is a popular first language for students.

TEXT
IDEA  →  PYTHON CODE  →  OUTPUT
(very simple to translate ideas into code)

Compiled vs Interpreted in Python

Language Type How It Runs Example
Compiled Language Code is translated before running C, C++
Interpreted Language Code is usually run by an interpreter Python, JavaScript

Python automatically converts code into internal bytecode and then runs it using the Python interpreter.

History of Python

Python was created by Guido van Rossum and first released in 1991.

The name "Python" comes from the famous British comedy show Monty Python's Flying Circus — not from the snake!

Version Year Key Change
Python 1.0 1994 First stable release
Python 2.0 2000 Added list features and memory cleanup
Python 3.0 2008 Modern syntax cleanup (Python 3 is the current standard)
Python 3.x Today Actively maintained and used across industries
TEXT
1991 → CREATED    2000 → PYTHON 2    2008 → PYTHON 3 (current version)

This entire course uses Python 3.

Features of Python

Feature Meaning
Simple & Readable Syntax is very close to plain English
Interpreted Code runs through the Python interpreter
Free & Open Source Free to download, use, and share
Large Standard Library Has built-in tools for math, files, dates, and networking
Portable The same code runs on Windows, Mac, and Linux
Multi-purpose Used for Web apps, Data Science, AI, and Automation
TEXT
READABLE + FREE + PORTABLE + HUGE LIBRARY → BEGINNER-FRIENDLY & INDUSTRY-READY

Applications of Python

Field Real-World Example
Web Development Backend of websites (using Django or Flask)
Data Science Analyzing data and building charts (Pandas, NumPy)
Artificial Intelligence Machine learning models (TensorFlow, PyTorch)
Automation / Scripting Automating routine file tasks
Software Testing Automated testing of applications
College Projects Student management systems, billing apps, quizzes

Installation and Setup

Follow these simple steps to install Python on your computer:

TEXT
1. Open your browser and go to python.org/downloads
2. Download the Python installer for your operating system (Windows / Mac / Linux)
3. Run the installer — IMPORTANT: Check the box "Add Python to PATH"
4. Open Command Prompt / Terminal and type: python --version

Verify your installation:

TEXT
$ python --version
Python 3.12.3

If your terminal says 'python' is not recognized, Python was not added to PATH during installation. Re-run the installer and check the "Add Python to PATH" box.

Python IDEs (Code Editors)

An IDE (Integrated Development Environment) is software that provides a code editor, execution tools, and error checking in one place.

Editor / IDE Best For
IDLE Comes built-in with Python; good for complete beginners
VS Code Free, lightweight, and most widely used in software companies
PyCharm Feature-packed IDE popular for large Python projects
Thonny Designed specifically for learning Python in schools/colleges
Jupyter Notebook Runs code in blocks; popular for Data Science

Online Code Editors

If you don't want to install software immediately, you can practice Python online in your browser:

  • online-python.com — Fast, simple, no signup required
  • Replit — Full online coding environment
  • Google Colab — Free cloud notebook for Python practice

Syntax Essentials

Python Syntax Rules

Syntax means the grammar rules of a programming language. Python syntax is clean: - No semicolons ; required at the end of lines - No curly braces {} required to mark code blocks - Code statements are written one per line

PYTHON
print("Welcome to College")
print("Python Programming Class")

Output:

TEXT
Welcome to College
Python Programming Class
TEXT
NO SEMICOLONS  |  NO CURLY BRACES  |  SIMPLE & CLEAN WRITING

Indentation in Python

Indentation (spaces at the start of a line) is mandatory in Python. Python uses indentation to define code blocks.

PYTHON
if 5 > 2:
    print("Five is greater than two!")
    print("This line is also inside the if block.")
print("This line is outside the if block.")

Output:

TEXT
Five is greater than two!
This line is also inside the if block.
This line is outside the if block.

If indentation is inconsistent or missing, Python raises an IndentationError:

PYTHON
if 5 > 2:
print("Five is greater than two!")

Output:

TEXT
IndentationError: expected an indented block
TEXT
CORRECT INDENTATION → CONSISTENT SPACING (4 SPACES RECOMMENDED)
INCORRECT SPACING  → IndentationError

Always use 4 spaces for each indent level. Do not mix tabs and spaces.

Comments and Notes in Python

A comment is a note written in code for human readers. Python completely ignores comments when running the program.

Single-line comments start with #:

PYTHON
# This line prints a welcome message
print("Hello, World!")  # Output welcome text

For longer notes at the start of a file or function, Python often uses triple-quoted strings called docstrings:

PYTHON
"""
Program: College Registration System
Author: Student
Description: This script demonstrates basic Python setup and output.
"""
print("System Ready")
Type Syntax Usage
Single-Line Comment # text Short notes on one line
Docstring / Multi-Line Note """ text """ Longer documentation text

Conclusion & Next Steps

In this module, you learned: 1. What Python is and why it is so popular 2. How to install Python and set up your editor (VS Code, IDLE, or online tools) 3. Basic syntax rules, mandatory indentation, and comments 4. How to display output using print()

Now that your setup is ready and you understand basic syntax, you are ready to learn Core Python — where we explore Variables, Keywords, Data Types, Type Conversion, Input/Output, and Operators in detail.


Placement Quick Points

  • Python was created by Guido van Rossum in 1991.
  • Python 3 is the current actively supported version.
  • Python code runs using the Python interpreter.
  • Always check "Add Python to PATH" during installation.
  • Indentation is mandatory in Python and defines code blocks.
  • 4 spaces per indentation level is the standard convention.
  • # is used for single-line comments; Python ignores comments.
  • print() is the built-in function used to display output.

Interview Questions

What is Python and who created it?
Python is a high-level, interpreted programming language created by Guido van Rossum in 1991.
Is Python compiled or interpreted?
Python is interpreted. It first converts code to internal bytecode and then runs it using the Python interpreter.
Why is indentation mandatory in Python?
Indentation defines code blocks instead of using curly braces {}.
What happens if you use wrong indentation in Python?
Python raises an IndentationError.
How do you write comments in Python?
Use # for comments. Triple quotes """ are often used for docstrings or longer notes.
What tool is used to display output in Python?
The built-in print() function.

Practice

  1. Write a Python statement to print your name and college name.
  2. Install Python on your computer and verify it using python --version.
  3. Create a .py file and run it from VS Code or Command Prompt.
  4. Add a single-line comment above a print() statement explaining what it does.
  5. Create a docstring or multi-line note describing your first Python program.
  6. Write a code snippet with correct indentation and observe the output.
  7. Fix the error in this code:
PYTHON
if 10 > 5:
print("10 is greater than 5")

End of Level 1 — Foundations