0% found this document useful (0 votes)
8 views20 pages

Python Data Types and Operations Guide

The document provides an introduction to Python, covering sequence operations such as concatenation, repetition, and slicing. It discusses data structures including lists, tuples, sets, and dictionaries, highlighting their operations and characteristics, particularly the immutability of tuples and frozensets. Additionally, it explains the differences between sets and frozensets, emphasizing the unique properties of each.

Uploaded by

thakureshan7
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)
8 views20 pages

Python Data Types and Operations Guide

The document provides an introduction to Python, covering sequence operations such as concatenation, repetition, and slicing. It discusses data structures including lists, tuples, sets, and dictionaries, highlighting their operations and characteristics, particularly the immutability of tuples and frozensets. Additionally, it explains the differences between sets and frozensets, emphasizing the unique properties of each.

Uploaded by

thakureshan7
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

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

You might also like