Skip to content

Tag Archives: Python string-programs

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: Attention geek! Strengthen your foundations… 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: Attention geek! Strengthen your foundations with… Read More
Given a string, which character followed by its frequency, create the appropriate string. Examples: Attention geek! Strengthen your foundations with the Python Programming Foundation Course and… Read More
Given a String. The task is to replace all the words with ‘?’ except the given word K. Examples:  Attention geek! Strengthen your foundations with the… 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 substring from the list of strings.… Read More
Given a String. The task is to return the number of characters in the string. Examples: Attention geek! Strengthen your foundations with the Python Programming Foundation… Read More
Given a string and a character, insert character after every K occurrences. Input : test_str = ‘GeeksforGeeks’, K = 2, add_chr = “;” Output : [‘;GeeksforGeeks’,… Read More
Given a String, convert it to Matrix, having K characters in each row. Input : test_str = ‘GeeksforGeeks is best’, K = 7 Output : [[‘G’,… Read More

Start Your Coding Journey Now!