KnowledgeBoat Logo

Computer Science

Start with the list [8, 9, 10]. Do the following using list functions:

  1. Set the second entry (index 1) to 17
  2. Add 4, 5 and 6 to the end of the list
  3. Remove the first entry from the list
  4. Sort the list
  5. Double the list
  6. Insert 25 at index 3

Python List Manipulation

82 Likes

Answer

listA = [8, 9, 10]

  1. listA[1] = 17
  2. listA.extend([4, 5, 6])
  3. listA.pop(0)
  4. listA.sort()
  5. listA = listA * 2
  6. listA.insert(3, 25)

Answered By

42 Likes


Related Questions