What is the syntax to change values in a list?

<list name>[<index of value to be changed>] = <new value>
#example
flowers=['tulips','roses','daisies']
flowers[-1] = 'sunflowers'
flowers[0] = 'lilacs'
print(flowers)

#output
['lilacs','roses','sunflowers']

 

 

Advertisements