Phase 5 - Category 3: Word Operations
Master word-level string operations.
10 programs · open one, then the next
Start with Print First Word- 01Print First WordBeginnerPrint first word of string.Open example →py# Take string input s = input("Enter a string: ") # Get first word
- 02Print Last WordBeginnerPrint last word of string.Open example →py# Take string input s = input("Enter a string: ") # Get last word
- 03Reverse Order of WordsIntermediateReverse the order of words in string.Open example →py# Take string input s = input("Enter a string: ") # Reverse words
- 04Find Longest WordIntermediateFind longest word in string.Open example →py# Take string input s = input("Enter a string: ") # Find longest word
- 05Find Shortest WordIntermediateFind shortest word in string.Open example →py# Take string input s = input("Enter a string: ") # Find shortest word
- 06Capitalize First Letter of Each WordIntermediateCapitalize first letter of each word.Open example →py# Take string input s = input("Enter a string: ") # Capitalize first letter of each word
- 07Swap First and Last WordIntermediateSwap first and last word in string.Open example →py# Take string input s = input("Enter a string: ") # Swap first and last word
- 08Count Words Starting with VowelIntermediateCount words starting with vowel.Open example →py# Take string input s = input("Enter a string: ") # Count words starting with vowel
- 09Remove Duplicate WordsIntermediateRemove duplicate words from string.Open example →py# Take string input s = input("Enter a string: ") # Remove duplicate words
- 10Sort Words AlphabeticallyIntermediateSort words in alphabetical order.Open example →py# Take string input s = input("Enter a string: ") # Sort words