# Capitalize a string in Python: Convert the first letter to uppercase and other letters to lowercase

The capitalize() converts a word to the "capitalized" word; the first letter is uppercase and other letters lowercase.

a = 'this iS an aPPle.'

b = a.capitalize()

print(b)  # This is an apple.


## Python Examples

print('3 Books weRE solD'.capitalize())
# 3 books were sold

print('"hello", he said.')
# "hello", he said.

print('  go '.capitalize())
#   go


Numbers, symbols and spaces remain the same after capitalized.