0% found this document useful (0 votes)
2 views1 page

Python MATLAB Notes

The document provides notes on mutable and immutable data types in Python, highlighting lists, sets, and dictionaries as mutable, while integers, floats, strings, and tuples are immutable. It includes a factorial function example, explains the binary search algorithm, and discusses the use of sets and dictionaries in Python. Additionally, it outlines control structures in MATLAB and mentions user-defined modules in Python.

Uploaded by

navadeepngit2453
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Python MATLAB Notes

The document provides notes on mutable and immutable data types in Python, highlighting lists, sets, and dictionaries as mutable, while integers, floats, strings, and tuples are immutable. It includes a factorial function example, explains the binary search algorithm, and discusses the use of sets and dictionaries in Python. Additionally, it outlines control structures in MATLAB and mentions user-defined modules in Python.

Uploaded by

navadeepngit2453
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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.

You might also like