String Capitalization Function

  • Share this:

Code introduction


Converts the first letter of the input string to uppercase and the rest to lowercase.


Technology Stack : str.capitalize()

Code Type : String processing

Code Difficulty :


                
                    
def capitalize_word(word):
    if not isinstance(word, str):
        raise ValueError("The input must be a string.")
    return word.capitalize()