# Tag Archives: Python tuple-programs

Given a Tuple list, remove all tuples with all None values. Input : test_list = [(None, 2), (None, None), (3, 4), (12, 3), (None, )] Output… Read More
Given a list of tuples, extract all tuples having K digit elements. Input : test_list = [(54, 2), (34, 55), (222, 23), (12, 45), (78,… Read More
Sometimes, while working with Python list, we can have a task in which we need to work with tuple list and get the absolute difference… Read More
Given a Tuple List sort tuples by maximum element in a tuple. Input : test_list = [(4, 5, 5, 7), (1, 3, 7, 4), (19,… Read More
Given a list of tuples. The task is to extract all tuples which have all elements divisible by K. Input : test_list = [(6, 24,… Read More
Given a Tuple. The task is to convert it to List by adding the given string after every element. Examples: Input : test_tup = (5,… Read More
Given a list of tuples. The task is to get all the tuples that have all positive elements. Examples: Input : test_list = [(4, 5,… Read More
Given a list of tuples, filter by Kth element presence in List. Input : test_list = [(“GFg”, 5, 9), (“is”, 4, 3), (“best”, 10, 29)],… Read More
Given a tuple, concatenate each element of tuple by delimiter. Input : test_tup = (“Gfg”, “is”, 4, “Best”), delim = “, ” Output : Gfg,… Read More
Given a Tuple Matrix, flatten to tuple list with each tuple representing each column. Input : test_list = [[(4, 5), (7, 8)], [(10, 13), (18,… Read More
Given a Tuple, find frequency of each element. Input : test_tup = (4, 5, 4, 5, 6, 6, 5) Output : {4: 2, 5: 3, 6:… Read More
Given Binary Tuple representing  binary representation of number, convert to integer. Input : test_tup = (1, 1, 0) Output : 6 Explanation : 4 +… Read More
Given tuple list, assign frequency to each tuple in list. Input : test_list = [(6, 5, 8), (2, 7), (6, 5, 8), (9, ), (2,… Read More
Given a Tuple list, remove K character from 1st element of Tuple being String. Input : test_list = [(“GF\$g!”, 5), (“!i\$s”, 4), (“best!\$”, 10)], K… Read More
Given list of tuples, sort by frequency of second element of tuple. Input : test_list = [(6, 5), (1, 7), (2, 5), (8, 7), (9,… Read More