Given the string, the task is to capitalise the first and last character of each word in a string.
Input: hello world Output: HellO WorlD Input: welcome to geeksforgeeks Output: WelcomE TO GeeksforgeekS
- Access the last element using indexing.
- Capitalize the first word using
- Then join the each word using
- Perform all the operations inside lambda for writing the code in one-line.
Below is the implementation.
String before: welcome to geeksforgeeks String after: WelcomE TO GeeksforgeekS
- How to capitalize first character of string in Python
- Pandas - Convert the first and last character of each word to upper case in a series
- Capitalize first letter of a column in Pandas dataframe
- string capitalize() in Python
- Python program to read file word by word
- numpy.defchararray.capitalize() in Python
- Python | Pandas Series.str.capitalize()
- PyQt5 QSpinBox - Making text capitalize
- PyQt5 QSpinBox – Checking if text is capitalize ?
- Python program to find the character position of Kth word from a list of strings
- Python program to find occurrence to each character in given string
- Find frequency of each word in a string in Python
- Queries to find the last non-repeating character in the sub-string of a given string
- Find the first repeated word in a string in Python using Dictionary
- Python - Separate first word from String
- Python program to interchange first and last elements in a list
- Python program to read character by character from a file
- Python | Frequency of each character in String
- Python | Reverse each word in a sentence
- Python | Count occurrences of each word in given text file (Using dictionary)