Skip to content

Tag Archives: Python string-programs

Given a String, the task is to write a Python program to check if the string has lowercase letters or not. Examples: Input: "Live life… Read More
Given a String. The task is to find out the Number Of Words And Characters Present In The String.  Examples: Input: Geeksforgeeks is best Computer… Read More
Given a String. The task is to swap the first and the last character of the string. Examples: Input: GeeksForGeeks Output: seeksForGeekG Input: Python Output:… Read More
Python program to display the letters in the first string but not in the second can be done by taking two sets and subtracting them.… Read More
The problem is to go through all the words in an array and the program should return the word with the longest one. Consider for… Read More
Given a String Matrix, sort each row by palindromic strings count. Input : test_list = [[“nitin”, “meem”, “geeks”], [“peep”], [“gfg”, “is”, “best”], [“sees”, “level”, “mom”,… Read More
Given a Strings List, extract all the strings, whose consecutive characters are at common difference in ASCII order. Input : test_list = [“abcd”, “egil”, “mpsv”,… Read More
Given Matrix, extract rows in which Strings don’t have spaces. Examples: Input : test_list = [[“gfg is”, “best”], [“gfg”, “good”], [“gfg is cool”], [“love”, “gfg”]] Output… Read More
Here we are going to see the approach of forming a string made from the first and last 2 characters of a given string. Input:… Read More
Given a String, ensure it has equal character frequencies, if not, equate by adding required characters. Input : test_str = ‘geeksforgeeks’ Output : geeksforgeeksggkkssfffooorrr Explanation : Maximum… Read More
Given Strings list, remove all the characters from each string that have characters greater than K. Input : test_list = [“geeksforgeeks”, “is”, “best”, “for”, “geeks”],… Read More
Given a List that contains only string elements, the following program shows methods how every other alphabet can be removed from elements except for a… Read More
Given a string, generate K length combinations in a one-liner. Input : test_str = ‘gfg’, K = 3 Output : [‘ggg’, ‘ggf’, ‘ggg’, ‘gfg’, ‘gff’, ‘gfg’,… Read More
Given a List and a String, test if the string can be made from list characters. Examples: Input : test_list = [‘g’, ‘g’, ‘e’, ‘k’,… Read More
Given a String, add a phrase in the middle of it. Input : test_str = ‘geekforgeeks is for geeks’, mid_str = “good” Output : geekforgeeks is… Read More