Python & MATLAB Notes
Mutable and Immutable Data Types
Mutable: list, set, dictionary (can be changed).
Immutable: int, float, string, tuple (cannot be changed).
Functions in Python
Functions improve code reuse, readability, and modularity.
Factorial Function
def factorial(n):
fact = 1
for i in range(1, n+1):
fact *= i
return fact
Binary Search Algorithm
Works on sorted arrays. Divide search space into halves repeatedly.
Sets in Python
Stores unique elements. Supports union and intersection.
Dictionaries in Python
Stores key-value pairs. Keys are unique.
MATLAB Control Structures
if, for, while, switch, break, continue.
User Defined Module
A Python file (.py) with functions that can be imported.