Python: Decapitalize the first letter of a given string
Decapitalize first letter in string.
Write a Python program to decapitalize the first letter of a given string.
- Use list slicing and str.lower() to decapitalize the first letter of the string.
- Use str.join() to combine the lowercase first letter with the rest of the characters.
- Omit the upper_rest parameter to keep the rest of the string intact, or set it to True to convert to uppercase.
Sample Solution:
Python Code:
Sample Output:
java Script python
Flowchart:
Python Code Editor:
Previous: Write a Python program to convert a given string to snake case.
Next: Write a Python program to split a given multiline string into a list of lines.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics