0% found this document useful (0 votes)
3 views36 pages

13.python Tuples

This document provides an overview of Python tuples, highlighting their characteristics such as being ordered, unchangeable, and allowing duplicates. It covers various operations with tuples including creation, access, updating, and manipulation, along with examples of practical applications. The document also includes methods for converting tuples to lists and performing operations like counting and joining tuples.
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)
3 views36 pages

13.python Tuples

This document provides an overview of Python tuples, highlighting their characteristics such as being ordered, unchangeable, and allowing duplicates. It covers various operations with tuples including creation, access, updating, and manipulation, along with examples of practical applications. The document also includes methods for converting tuples to lists and performing operations like counting and joining tuples.
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 Tuples

Tuple

• Tuples are used to store multiple items in a single


variable.

• A tuple is a collection which is ordered, unchangeable


and Allow Duplicates

• Tuples are written with round brackets().


Allow Duplicates
Tuple Length
Create Tuple With One Item
tuple() Constructor
Access Tuple Items
Negative Indexing
Range of Indexes
Example
Update Tuples
Convert tuple to list
Add Tuple to list
Add Tuple to Tuple
Remove Items
del keyword
Loop with Tuples
Join Tuples
Example
Extending Tuple
Tuples using sum() Method
Finding the first Index
Counting Tuple Items
Example
To Create 5 Random Integers Number
Vowels in a sentence as tuples in Python
Tuple of distinct characters in a list of
strings in Python
Tuple of ASCII values for characters in a
string in Python
Tuple of common letters between two words
in Python
Tuple of positive numbers from a list in
Python
Tuple of common elements between two lists
in Python
Tuple of sums of digits in numbers in
Python
Tuple of pairs of words and their lengths in
Python
Tuple of pairs of numbers and their sum
from two lists in Python
Tuple of odd numbers from 1 to 20 in
Python
Thank You

You might also like