In [2]:
capitalize()
Converts the first character to uppercase.
capitalize()
text = "hello world"
print(text.capitalize()) # Output: 'Hello world'
**Description:**
Converts the first character of a string to uppercase and the rest to lowercase.
**Example:**
“`python
text = “hello world”
print(text.capitalize()) # Output: ‘Hello world’
“`
**Use Case:**
Useful for formatting strings, especially when dealing with titles or sentences.