Skip to content

Tag Archives: Python string-programs

Given string of words separated by some delimiter. The task is to sort all the words given in the string Input : test_str = 'gfg:is:best:for:geeks',… Read More
Given list of strings. The task is to find the frequency of the elements which are common in all strings given in the list of… Read More
Given a Tuple List, extract tuples, which have strings made up of certain characters. Input : test_list = [(‘gfg’, ‘best’), (‘gfg’, ‘good’), (‘fest’, ‘gfg’)], char_str… Read More
Given a list, extract range of consecutive similar elements. Input : test_list = [2, 3, 3, 3, 8, 8] Output : [(2, 0, 0), (3, 1,… Read More
Given a Strings List, extract those with atleast one digit. Input : test_list = [‘gf4g’, ‘is’, ‘best’, ‘gee1ks’] Output : [‘gf4g’, ‘gee1ks’] Explanation : 4, 1 are… Read More
Given a String list, perform sort by the rear character in Strings list. Input : test_list = [‘gfg’, ‘is’, ‘for’, ‘geeks’] Output : [‘gfg’, ‘for’, ‘is’,… Read More
Given a list of strings. The task is to sort the list of strings by the number of unique characters. Examples: Input : test_list =… Read More
Given a String list, check for all string if it matches the desired string length from 2nd list of sizes. Input : test_list = [“Gfg”,… Read More
Given a string list, extract list which has any succession of characters as they occur in alphabetical order. Input : test_list = [‘gfg’, ‘ij’, ‘best’,… Read More
Given a list of strings. The task is to sort the list by the numeric part of the string. Examples: Input : test_list = [“Gfg34”,… Read More
Given a string, which characters followed by its frequency, create the appropriate string. Examples: Input : test_str = ‘g7f2g3i2s2b3e4’ Output : gggggggffgggiissbbbeeee Explanation : g is succeeded… Read More
Given a string. The task is to replace all the words with ‘?’ except the given word K. Examples:  Input : test_str = ‘gfg is… Read More
Given a String, retain first N elements and replace rest by K. Input : test_str = ‘geeksforgeeks’, N = 5, K = “@” Output : geeks@@@@@@@@ Explanation… Read More
Given a String, perform the double split, 1st for rows, and next for individual elements so that the given string can be converted to a… Read More
Given a list of strings and a list of substring. The task is to extract all the occurrences of a substring from the list of… Read More

Start Your Coding Journey Now!