Ubah daftar dengan fungsi loop di Python

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

for index, value in enumerate(cities):
    cities[index] = value.title()

print(cities)

# output - ['New York City', 'Mountain View', 'Chicago', 'Los Angeles']
Gifted Gannet