Computer Science, asked by Ravisahni6958, 11 months ago

Give an example to update single or multiple elements of lists

Answers

Answered by gratefuljarette
1

Through providing the slice on the left side of the assignment operator you can change single or multiple elements of the lists, and you can add items to a list using the append) (form.)

Explanation:

  • /user / bin / python listl = ['physics', 'chemistry' 1997, 2000]; print 'Price Available in index 2:' print list[2]; list[2] = 2001; print 'Current Price Available in index 2:' print list[2]; note: append))) is addressed in the next portion.
  • Once the code above is performed, the outcome will be as follows: value available at index 2: 1997 Current value available at index 2: 2001
Similar questions