Skip to content

Tag Archives: python-tuple

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
1) What is the output of the following program? L = list('123456') L[0] = L[5] = 0 L[3] = L[-2] print(L) a) [0, ‘2’, ‘3’,… Read More
Prerequisite: Lists and Tuples 1) What is the output of the following program?   PYTHON List = [True, 50, 10] List.insert(2, 5)    print(List, "Sum is: ",… Read More
Prerequisite: List and Tuples Note: Output of all these programs is tested on Python3 1) What is the output of the following program?  PYTHON L1 =… Read More
We use two operators * (for tuples) and ** (for dictionaries).  Background Consider a situation where we have a function that receives four arguments. We want… Read More
A Tuple is a collection of Python objects separated by commas. In someways a tuple is similar to a list in terms of indexing, nested… Read More
In the previous article, we read about the basics of Python. Now, we continue with some more python concepts. Strings in Python A string is a… Read More