Introduction to Python
Noble Xavier
Sequence Operations
◈ Concatenation
◈ Repetition
◈ Membership testing
◈ Slicing
◈ Indexing
List
List Operations
List Operations
Tuples
Adv:
• Faster
• Values can’t be changed
Tuple
Tuple
Tuple
Converting list to tuple
String
String Formatting
String Operations
Set
◈ Un ordered collection of Unique items, separated by {}
◈ Used to collect unique strings and int
◈ Operations
◈ Union (|)
◈ Intersection (&)
◈ Di erence ( -)
Set
Set Operations
Remove – Error if the element not present
Discard – No error if not present
Frozen Set
Frozen means unmoving or fixed.
The frozenset() is an inbuilt function in python that takes an iterable object as input and makes
them immutable. It simply freezes the iterable objects and makes them unchangeable.
Frozenset is a new class that has the characteristics of a set, but its elements cannot be
changed once assigned. That is once you created the set, it becomes immutable. Frozenset is
also called a read-only set.
Frozenset Vs Set
Set is a most basic level datatype, It supports all the method operations of the set such as
add(), remove(), and so on.
The Frozen set is immutable, it does not support any operations like add(), remove(), and so
on.
Dictionaries
Dictionaries
Dictionary methods