Skip to content

Tag Archives: python-string

Given a string, write a Python program to remove all spaces from it. Examples: Input : g e e k Output : geek Input :… Read More
Let’s take a password as a combination of alphanumeric characters along with special characters, and check whether the password is valid or not with the… Read More
Given a string, toggle the characters of those words who have all their characters in the same case. Examples: Input : Geeks for Geeks Output… Read More
Python String lstrip() method returns a copy of the string with leading characters removed (based on the string argument passed). If no argument is passed,… Read More
translate() returns a string that is modified string of givens string according to given translation mappings. There are two ways to translate : Providing a… Read More
Given a string str, the task is to extract all the numbers from a string and find out the most occurring element of them using… Read More
Given a string, print all the possible substrings which are also the prefix of the given string. Examples: Input : ababc Output : a, ab,… Read More
In Python, while operating with String, one can do multiple operations on it. Let’s see how to iterate over characters of a string in Python.… Read More
Given a list of dates in string format, write a Python program to sort the list of dates in ascending order. Examples: Input : dates… Read More
Write a Python program to convert a given string to datetime and vice-versa. Program to convert string to DateTime using strptime() function. Examples: Input :… Read More
Given a list of strings, the task is to sort that list based on given requirement. There are multiple scenarios possible while sorting a list… Read More
Given a list, write a Python program to convert the given list to string. There are various situations we might encounter when a list is… Read More
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
The generic problem faced by the programmers is removing a character from the entire string. But sometimes the requirement is way above and demands the… Read More
Given a string S consisting only of lowercase letters, the task is to check if the frequency of all characters of the string is unique.… Read More

Start Your Coding Journey Now!