Skip to content

Tag Archives: python-tuple

Python Tuples In python tuples are used to store immutable objects. Python Tuples are very similar to lists except to some situations. Python tuples are… Read More
Given a list of tuples, write a Python program to sort the tuples by the second item of each tuple. Examples: Input : [('for', 24),… Read More
There are many iterables in Python like list, tuple etc. range() gives another way to initialize a sequence of numbers using some conditions.range() is commonly… Read More
Tuple is a collection of Python objects much like a list. The sequence of values stored in a tuple can be of any type, and… Read More
The Python tuple() function is a built-in function in Python that can be used to create a tuple. A tuple is an ordered and immutable… Read More
As we know that in Python, tuples are immutable, thus it cannot be changed or altered. This provides us with limited ways of reversing a… Read More
In this article, we will see how can we remove an empty tuple from a given list of tuples. We will find various ways, in… Read More
Given a binary matrix, print all unique rows of the given matrix. Order of row printing doesn’t matter.  Examples: Input: mat = [[0, 1, 0,… Read More
In this article, we will see how we can sort a tuple (consisting of float elements) using its float elements. Here we will see how… Read More
Sometimes you might need to convert a tuple to dict object to make it more readable. In this article, we will try to learn how… Read More
In this program, we need to accept a tuple and then find the number of times an item is present in the tuple. This can… Read More
In this problem, we need to accept a list. The list can have nested tuples. We need to count the elements in a list until… Read More
Given a tuple, sort the list of tuples in increasing order by any key in tuple. Examples: Input : tuple = [(2, 5), (1, 2),… Read More
Prerequisite : Tuples Note: Output of all these programs is tested on Python3 1. What will be the output of the following program ? tuple… Read More