Измените список с функцией цикла и диапазона в Python

cities = ['new york city', 'mountain view', 'chicago', 'los angeles']

for index in range(len(cities)):
    cities[index] = cities[index].title()

print(cities)

# output - ['New York City', 'Mountain View', 'Chicago', 'Los Angeles']
Rajitha Amarasinghe