Python Basics Course Script
Instructor: Usman Fateh Muhammad
A Professional Curriculum Guide for Beginners
Module 1: Introduction to Python
Lesson 1: What is Python?
Welcome students to the Python Basics course! This comprehensive masterclass program is developed
by your instructor, Usman Fateh Muhammad, and is specifically engineered to fast-track your journey
into professional software development.
Python is an advanced, high-level, interpreted programming language widely acclaimed for its
architectural clean lines, flexibility, and powerful footprint across modern global tech ecosystems. It
serves as the primary engine for:
Web Development: Enterprise applications, scalable backend infrastructure frameworks, and cloud
APIs.
Artificial Intelligence: Machine learning model architectures, deep neural networks, and computer
vision systems.
Data Science: Big data processing, predictive statistical analytics algorithms, and business
intelligence pipelines.
Automation: Automation scripting for operational workflow optimization, task schedulers, and
systems management.
Game Development: Rapid prototyping, algorithmic simulations, and 2D/3D physics engine game
frameworks.
Python is exceptionally beginner-friendly due to its deliberate structural emphasis on highly clear,
human-readable syntax rules that mirror standard English expressions.
Code Execution Demonstration:
print("Hello World")
ℹ️Key Concept: The print() function is a foundational built-in Python operation used to stream string
character outputs to stdout (the console terminal environment).
Lesson 2: Installing Python & VS Code
Follow these sequential system configurations to stand up your professional localized integrated
development environment (IDE):
Step 1: Download Python - Navigate to the official core software distribution server at [Link]
and fetch the latest verified stable binary package release tailored for your desktop OS framework.
Step 2: Initialize Installer - Launch the downloaded installation execution assistant binary module on
your machine.
Step 3: Path Environment Configuration - CRITICAL DIRECTIVE: Prior to hitting the 'Install Now'
pathway button, check the system option checkbox labeled 'Add Python to PATH'. This map injects
the compiler globally into your terminal execution profile.
Step 4: IDE Workspace Setup - Acquire and run Visual Studio Code (VS Code), an industry-standard,
lightweight, robust engineering editor platform.
Step 5: Ecosystem Extension Integration - Open the VS Code extensions marketplace panel
(Ctrl+Shift+X), search for 'Python' authored by Microsoft, and trigger its deployment to activate
inline error validation, automated code formatters, and integrated execution terminals.
Lesson 3: Your First Python Program
Create, configure, and evaluate your initial source script file to audit your system execution health:
Workspace Script Asset: Initialize a completely blank text document within your development
workspace sub-directory and save it exactly as: [Link]
Populate the clear script structure with the subsequent program command declaration statement:
print("Welcome to Python")
Execution: Run the program loop inside the built-in VS Code command terminal window by outputting
python [Link] and confirming via Enter. The literal text segment string will map to your active output
console.
Lesson 4: Core Python Syntax Rules
In contrast to archaic software programming architectures relying extensively on heavy curly brackets or
trailing semicolons to delineate logical pathways, Python strictly regulates structural context through
code alignment spacing:
Indentation Restraints: Python uses uniform code indentation spacing blocks (the industry
paradigm standard is 4 character spaces) to map execution scope, structural functions, and block
logic levels.
Structural Conditional Code Statement Layout Blueprint:
if 5 > 2:
print("Five is greater")
Rule 1: Proper Indentation - Enforce matching block alignments for all items dwelling inside
identical conditional logic planes. Intermingling tab characters and system spaces will break
execution with an IndentationError.
Rule 2: Case-Sensitive Architecture - Python parses matching terms differently based on spelling
casing states. The variable name 'Instructor' and its counterpart reference 'instructor' link to
completely unique system register addresses.
Rule 3: Highly Readable Lexical Design - The lexical structure is crafted to maximize clarity and
readability, driving down code base long-term maintenance costs.
Lesson 5: Code Documentation & Comments
Code comments deliver plain-text inline summaries for humans without interrupting or altering parsing
flows inside the execution compiler.
Single-line clarifying remarks are declared using a leading hash operator:
# This is a single-line comment evaluating a condition
Multi-line documentation block descriptions utilize clear matching triple string quotes:
"""
This is a multi-line comment block
intended for detailed technical documentation.
"""
Lesson 6: Standard Input & Output Operations
Facilitating runtime interactive loops between human operators and terminal consoles rests on native
I/O methods:
Standard Stream Console Outputs:
print("Hello")
Capturing Keyboard String Inputs at Runtime:
name = input("Enter your name: ")
print(name)
Module 2: Variables & Data Types
Lesson 1: Dynamic Variable Declarations
Variables represent named allocation aliases pointing to physical runtime memory register positions
holding assigned data records. Python utilizes robust structural dynamic type parsing, eliminating
manual primitive type statements.
name = "Usman Fateh Muhammad"
age = 18
ℹ️Instructor Insight: Python handles memory allocation entirely under the hood, parsing the value format
at runtime to automatically shape the target primitive layout classification.
Lesson 2: Primitive Data Types
Python objects store localized technical data structures organized into distinct built-in categorical
configurations:
Integers (int): Complete integers containing zero fractional parts. Example code format: num = 10
Floats (float): High-precision rational fractional mathematical numbers. Example code format: price
= 99.5
Strings (str): Read-only character text sequences isolated inside enclosing code strings. Example
code format: name = "Ali"
Booleans (bool): Pure binary evaluation flags reflecting only the absolute options of True or False.
Example code format: is_student = True
Lesson 3: Type Conversion & Explicit Casting
The built-in input() tool returns captured computer data exclusively in a String structure. To evaluate
math or logic operators against scalar input parameters, they must be manually re-cast using explicit
class constructors:
age = int(input("Enter age: "))
print(age)
Lesson 4: User Input Integration Programs
Combining sequential user input events into organized, multi-variable textual display routines:
name = input("Enter name: ")
city = input("Enter city: ")
print("Name:", name)
print("City:", city)
Module 3: Operators & Expressions
Lesson 1: Arithmetic Operators
Process raw math computations on data types using standard math expressions:
a = 10
b = 5
print(a + b) # Addition -> 15
print(a - b) # Subtraction -> 5
print(a * b) # Multiplication -> 50
print(a / b) # True Division -> 2.0
Lesson 2: Comparison & Relational Operators
Examine inequalities or true matching identity equivalents between target values, returning a strict
boolean object state:
print(10 > 5) # Evaluates to True
print(10 == 5) # Equivalence verification check. Evaluates to False
Lesson 3: Logical Operators
Interconnect multiple condition checks into comprehensive multi-layered Boolean evaluation rules:
print(True and False) # Conjunction criteria. Both must match -> False
print(True or False) # Disjunction criteria. At least one must match ->
True
Lesson 4: In-Place Assignment Operators
Optimize standard in-place mutation patterns updating an assigned address without writing long
duplicate terms:
x = 5
x += 2 # Syntactically identical to: x = x + 2
print(x) # Output evaluation value: 7
Module 4: Conditional Control Flow Statements
Lesson 1: The 'if' Control Structure
Enclose an independent block of application code statements designed to pass compilation criteria
strictly when a rule records as True:
age = 18
if age >= 18:
print("Adult")
Lesson 2: Binary Branching with 'if-else'
Establish alternative operational fallback tracks to execute when the core rule evaluation evaluates as
false:
num = 10
if num % 2 == 0:
print("Even")
else:
print("Odd")
Lesson 3: Multi-Tiered Evaluation Branching via 'elif'
Chain a sequence of matching structural inspections where the engine validates top-down and parses
uniquely the first valid code wing:
marks = 80
if marks >= 90:
print("A")
elif marks >= 70:
print("B")
else:
print("C")
Lesson 4: Nested Conditions
Embed an entire conditional sub-structure inside another parent logical block to construct elaborate,
multi-phased gating safety rules:
age = 20
has_id = True
if age >= 18:
if has_id:
print("Allowed")
Module 5: Loop Iteration Architectures
Lesson 1: Definite Iteration with 'for' Loops
Loop across an arranged iterable sequence list, dictionary collection, or precise index spectrum range:
for i in range(5):
print(i)
Lesson 2: Indefinite Iteration with 'while' Loops
Execute an active workflow block continuously for as long as a baseline status checkpoint rule stays true:
x = 1
while x <= 5:
print(x)
x += 1
Lesson 3: Control Modification via 'break' & 'continue'
Intervene manually in normal sequential loop tracking logic layers during live thread operation:
break: Forces an abrupt, complete exit from the executing loop architecture instantly.
continue: Ceases processing inside the current pass and advances the index counter directly to the
subsequent iteration.
Break Loop Control Blueprint:
for i in range(10):
if i == 5:
break
print(i)
Lesson 4: Maximizing the range() Constructor
Generate linear arithmetic numerical array bounds using configured limits configured as (start,
stop_exclusive, step_interval):
for i in range(1, 11):
print(i)
Module 6: Textual String Manipulation
Lesson 1: String Basics
Strings represent structured character arrays. They belong to Python's immutable type classification,
indicating that specific positions cannot be over-written or modified in-place post-instantiation.
name = "Python"
print(name)
Lesson 2: Indexing & Slicing Subsets
Extract separate single character items using zero-indexed notation positions, or grab sub-strings via
sequence slicing bounds [start:stop_exclusive]:
text = "Python"
print(text[0]) # Pulls the item at zero index -> "P"
print(text[0:3]) # Slices index positions 0, 1, and 2 -> "Pyt"
Lesson 3: Native Built-In String Methods
Execute transformations or extract structural metadata updates from string properties using attached
object methods:
name = "python"
print([Link]()) # Maps characters to "PYTHON"
print([Link]()) # Maps characters to "python"
Lesson 4: Advanced String Formatting
Interpolate dynamic evaluation variables cleanly inside string literals by prefixing quotes with the
character format indicator 'f':
name = "Ali"
age = 20
print(f"My name is {name} and age is {age}")
Module 7: Advanced Collection Data Structures
Lesson 1: Ordered, Mutable Lists
Lists act as ordered sequence containers tracking multi-item arrays. They are completely mutable,
meaning they allow full programmatic mutations, position edits, and value overwrites.
fruits = ["Apple", "Banana", "Mango"]
print(fruits)
Lesson 2: Dynamic List Mutation Methods
Inject, append, delete, or pop element blocks from an existing allocated list instance address:
[Link]("Orange")
print(fruits) # Output: ["Apple", "Banana", "Mango", "Orange"]
Lesson 3: Immutable Ordered Tuples
Tuples track static ordered arrays that match lists but are read-only and immutable. Encapsulated using
curved parenthesis, they lock structural multi-value records securely.
colors = ("Red", "Blue")
print(colors)
Lesson 4: Key-Value Dictionary Maps
Dictionaries associate unique hash keys directly to specific item records, ensuring extremely fast search
performance across complex databases.
student = {
"name": "Ali",
"age": 20
}
print(student["name"])
Module 8: Modular Functions & Lambda Expressions
Lesson 1: Creating and Invoking Functions
Functions are isolated, self-contained modular code blocks written to process designated repetitive
operations, drastically minimizing script bloat and layout entropy.
def greet():
print("Hello")
greet()
Lesson 2: Parameters & Arguments
Functions accept structural signature parameters, routing external live variables directly into localized
isolated running scopes:
def greet(name):
print("Hello", name)
greet("Usman Fateh Muhammad")
Lesson 3: The 'return' Operational Keyword
Functions channel processed evaluations back out to the parent calling script layer by invoking the
return instruction keyword, halting internal block traversal on execution.
def add(a, b):
return a + b
result = add(2, 3)
print(result) # Output: 5
Lesson 4: Lambda Basics
Declare compact, single-expression nameless throw-away functions directly inline using the lambda
keyword:
square = lambda x: x * x
print(square(5)) # Output evaluation: 25
Module 9: Disk File I/O Handling Operations
Lesson 1: Reading Files from Disk
Establish connections to target disk text documents utilizing the open() built-in feature combined with
explicit access permissions:
file = open("[Link]", "r") # "r" establishes safe Read permissions
print([Link]())
[Link]() # Always close the connection safely to clear memory
allocation
Lesson 2: Writing and Overwriting Document Content
Commit data streams to local disk files using the 'w' access permission indicator. Critical Warning: This
operational pathway completely purges and overwrites preexisting files under that name.
file = open("[Link]", "w") # "w" sets destructive write-overwrite
permissions
[Link]("Hello Python")
[Link]()
Lesson 3: Appending Data Records Safely
To protect historical content integrity and safely append data updates directly onto the absolute end of
the target file structure, call the 'a' append mode wrapper:
file = open("[Link]", "a") # "a" sets safe append tracking parameters
[Link]("\nNew Line")
[Link]()