Category: Python Programs

Python program to remove last N characters from a string

Python program to remove last N characters from a stringGiven a string S and an integer N, the task is to remove N characters from the end of the string S.Input: S = “GeeksForGeeks”, N = 5Output: GeeksForExplanation: Removing the last 5 characters from “GeeksForGeeks” modifies the string to “GeeksFor”.Input: S = “Welcome”, N = […]

Continue Reading

Generate all possible permutations of words in a Sentence

Generate all possible permutations of words in a SentenceGiven a string S, the task is to print permutations of all words in a sentence.Examples:Input: S = “sky is blue”Output:  sky is bluesky blue isis sky blueis blue skyblue sky isblue is skyInput: S =” Do what you love”Output:Do what you loveDo what love youDo you […]

Continue Reading