Getting Started with Python
Chapter 1: Introduction to Programming | Class 11 Computer Science
ORIGINS OF PYTHON
The Creator: Designed by Dutch programmer Guido van Rossum and
launched in 1991.
Named After: The British comedy troupe "Monty Python's Flying Circus".
Guido chose it to emphasize a fun and approachable environment.
Lineage & Inherited Strengths:
Readable layout style from ABC Language.
Modular system characteristics from Modula-3.
Guido designed Python to be open-source and easy, so anyone could contribute. This is why it has grown into one of the largest developer ecosystems
in the world!
WHY PYTHON?
Easy to Learn Open Source Portable
The syntax is clear and Python is free to use and Write once, run anywhere.
resembles the English distribute, even for Python scripts work on
language, making it the ideal commercial purposes, via Windows, Mac, and Linux
first language for beginners. [Link]. without changes.
Where is Python Used?
Web Development Artificial Intelligence Data Science
Powering server-side web backends with The core language for ML, Deep Learning, and Unlocks patterns and parses large datasets
premium frameworks like Django and Flask. AI using TensorFlow, PyTorch, and efficiently using Pandas, NumPy, and
Scikit-Learn. Matplotlib.
From NASA data pipelines to Netflix recommendations, Python is the engine. Learning Python in Class 11 sets up a high-paying future career!
PYTHON IN ACTION
Web Development Data Analytics AI & Machine Learning
Django & Flask frameworks Pandas, NumPy & Matplotlib TensorFlow & Scikit-learn
How Python Compares
Feature Python C++ Java
Execution Type Interpreted (Line-by-line) Compiled (All at once) Hybrid (Compiled to Bytecode)
Syntax Style Simple & English-like Complex & Strict punctuation Verbose & Boilerplate heavy
Block Structure Indentation (Whitespace) Curly Braces { } Curly Braces { }
Variables Dynamically typed Statically typed Statically typed
Development Speed Very Fast Moderate / Slow Moderate
While C++ compiled code runs faster, Python's development speed is drastically faster, making it much more productive for modern software
engineering.
INSTALLATION & SETUP
2. Install 4. Choose IDE
Run installer. Check "Add Use IDLE, VS Code, or
Python to PATH". PyCharm for coding.
1. Download 3. Verify
Visit [Link] and get Type python --version in
the latest version. the Command Prompt.
Interactive vs Script Mode
Interactive Mode (REPL) Script Mode
Execute commands on-the-fly and get instant Write your commands in a text editor, save with a .py
responses. Great for testing single lines. extension, and execute all at once.
Limitation: Code is not saved. Lost when closed! Advantage: Saved and reusable forever.
Mastering the Indentation Rule
In most programming languages, blocks are grouped using
curly braces { }. In Python, we use **whitespaces/tabs**
(Indentation) to define code blocks!
Correct Code:
Incorrect (Will Crash!):
INDENTATION TIP
Always use 4 spaces or exactly 1 tab for indenting inside loops or structures. Mixing spaces and tabs will trigger an IndentationError!
ANATOMY OF TOKENS
The smallest individual unit in a source program is called a Token. Python
recognizes five distinct groups:
Keywords: Reserved words carrying special meaning (e.g., if, while, Standard Case rules: Python is strictly case-sensitive. myVariable and
import, True). myvariable are unique identifiers.
Identifiers: User-defined names for variables and functions. Must start
with a letter or underscore.
Literals: Direct constants/values stored (e.g., 10, "Alice").
Operators: Symbols performing arithmetic or logic (e.g., +, %, ==).
Students often name variables with invalid characters (like hyphens or starting digits, e.g. 1st_roll). Highlight that only letters, digits, and underscores (_) are valid, and identifiers
*must not* start with a digit.
DEBUGGING: ERROR CATEGORIES
Syntax Errors Runtime Errors Logical Errors
Occurs when program breaks grammatical rules of Syntactically valid file which crashes abruptly during Runs perfectly without crashes but outputs incorrect
Python. Program execution fails to start. execution on illegal runtime tasks. math calculations due to faulty coder logic.
DEBUGGING EXERCISES
Give simple output tracing exercises. Have students intentionally debug mathematical expressions to easily differentiate runtime vs. logical errors.
BASIC SYNTAX RULES
Your First Program
Case Sensitivity: Age and age are different.
Comments: Use # for single-line notes.
Indentation: Crucial for loops and functions. Missing
indentation causes errors.
FIRST PROGRAM & INPUT/OUTPUT
Writing output with print(): Outputs processed values as string
structures to console terminal.
Accepting Console Input: input() reads data from user as standard
**String** value type. Requires explicit casting/conversion for
calculations.
EXAM WARNING TIP
Remind students: input() *always* returns string. Trying arithmetic operations like input() + 10 directly results in a TypeError!