# Tag Archives: Python tuple-programs (adsbygoogle = window.adsbygoogle || []).push({});

## Python | Find the tuples containing the given element from a list of tuples

Given a list of tuples, the task is to find all those tuples containing the given element, say n. Examples: Input: n = 11, list… Read More »

## Python | Get sum of tuples having same first value

Given a list of tuple, the task is to sum the tuples having same first value. Examples: Input: [(1, 13), (2, 190), (3, 82), (1,… Read More »

## Python | Remove all strings from a list of tuples

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 »

## Python | Linear search on list or tuples

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 »

## Python | Get first element with maximum value in list of tuples

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 »

## Python | Merge two lists into list of tuples

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 »

## Python | Convert a list into a tuple

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 »

## Python | Program to count duplicates in a list of tuples

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 »

## Python | Program to convert a tuple to a string

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 »

## Python program to create a list of tuples from given list having number and its cube in each tuple

Given a list of numbers of list, write a Python program to create a list of tuples having first element as the number and second… Read More »

## Python program to sort a list of tuples by second Item

Given a list of tuples, write a Python program to sort the tuples by second item of each tuples. Examples: Input : [(‘for’, 24), (‘Geeks’,… Read More »

## Python | Count the elements in a list until an element is a Tuple

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 »