Skip to content

Tag Archives: Python tuple-programs

Given a list of tuples, containing both integer and strings, the task is to remove all strings from list of tuples. Examples: Input : [(1,… Read More
Let’s see a basic linear search operation on Python list and tuples. A simple approach is to do linear search, i.e Start from the leftmost… Read More
In Python, we can bind structural information in form of tuples and then can retrieve the same. But sometimes we require the information of tuple… Read More
Given two lists, write a Python program to merge the two lists into list of tuples. Examples: Input : list1 = [1, 2, 3] list2… Read More
Given a list, write a Python program to convert the given list into a tuple. Examples: Input : [1, 2, 3, 4] Output : (1,… Read More
Given a list of tuples, write a Python program to check if an element of the list has duplicates. If duplicate exist, print the number… Read More
Given a tuple of characters, Write a python program to convert the tuple into a string.  Examples:  Input : ('a', 'b', 'c', 'd', 'e') Output… 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
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