14 Sections
61 Lessons
10 Weeks
Expand all sections
Collapse all sections
Python Foundations Program
A beginner-level course that covers Python basics, including syntax, variables, data types, control flow, functions, files, and libraries, helping students build a strong foundation in Python programming.
0
Installation
4
2.1
Install Python from the official website.
2.2
Install Visual Studio Code as your code editor.
2.3
Add Python to system PATH during installation.
2.4
Use the terminal or command prompt to verify installation with python –version.
Language Overview
6
3.1
Python is interpreted, high-level, and dynamically typed.
3.2
print() is used for output; indentation defines blocks.
3.3
Statements: instructions Python executes (e.g., x = 5).
3.4
Expressions: values combined using operators (e.g., x + y).
3.5
Comments start with #; multi-line with triple quotes (”’).
3.6
Code structure depends on proper indentation (whitespace matters).
Types and Values
5
4.1
Basic types: int, float, str, bool.
4.2
type() shows the data type; id() returns the memory address.
4.3
Sequence types: list, tuple, range.
4.4
Strings are immutable; concatenation with +.
4.5
Type conversion: str(), int(), float(), bool().
Conditionals
4
5.1
Syntax: if, elif, else.
5.2
Logical operators: and, or, not.
5.3
Comparison operators: ==, !=, >, =, <=.
5.4
Ternary operator: x if condition else y.
Loops
4
6.1
while loop: runs as long as a condition is True.
6.2
for loop: iterates over sequences (list, str, range()).
6.3
Use break, continue, and pass for control flow.
6.4
range(start, stop, step) used in numeric iteration.
Operators
5
7.1
Arithmetic: +, -, *, /, %, //, **.
7.2
Bitwise: &, |, ^, ~, <>.
7.3
Comparison: ==, !=, >, =, <=.
7.4
Boolean: and, or, not.
7.5
Operator precedence determines execution order.
Functions
5
8.1
Defined using def; can return values with return.
8.2
Use *args for variable arguments, **kwargs for keyword arguments.
8.3
Positional, keyword, default, and variable-length arguments.
8.4
Functions can return multiple values as tuples.
8.5
Generators use yield for memory-efficient iteration.
Structured Data
6
9.1
Use import to bring in built-in or custom modules.
9.2
Common modules
9.3
sys: system-specific functions and variables.
9.4
math: mathematical functions.
9.5
time: time-related functions.
9.6
Use dir(module) to explore module contents.
String Objects
4
10.1
Strings are immutable sequences of Unicode characters.
10.2
Methods: .lower(), .upper(), .replace(), .find(), .strip().
10.3
Formatting: f”Hello, {name}” or “{}”.format(value).
10.4
Splitting and joining strings with .split() and .join().
File I/O
5
11.1
Open files with open(‘filename’, ‘mode’).
11.2
Modes: ‘r’, ‘w’, ‘a’, ‘rb’, ‘wb’.
11.3
Read/write using .read(), .write(), .readlines().
11.4
Use with open() as file: to auto-close files.
11.5
Handle command-line arguments using sys.argv.
Python: What's Built-In
4
12.1
Use min(), max(), sum(), len(), sorted() for basic operations.
12.2
Type functions: type(), isinstance().
12.3
range() generates a sequence of numbers.
12.4
abs(), round(), pow() for numeric manipulation.
Modules in Python
4
13.1
Standard Modules – sys
13.2
Standard Modules – math
13.3
Standard Modules – time
13.4
The Dir Function
Exceptions
5
14.1
Use try, except to handle runtime errors.
14.2
Optionally use else and finally blocks.
14.3
Catch specific exceptions (e.g., ZeroDivisionError, ValueError).
14.4
Use raise to manually trigger exceptions.
14.5
Use assert to enforce conditions during debugging.
Python Foundations Program
Curriculum
This content is protected, please
login
and enroll in the course to view this content!
Your Website
Modal title
Main Content