Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 427 Bytes

append_and_insert.md

File metadata and controls

18 lines (12 loc) · 427 Bytes

Append & Insert

  1. Given the list li = [2, 0, 2, 2]

    1. Append to the end of the list the number 7
    2. Insert to the beginning of the list the number 1
    3. Insert in the second place the number 20
  2. What will be the result of running the following line? li.insert(20, 0)

Solution

    1. li.append(7)
    2. li.insert(0, 1)
    3. li.insert(1, 20)
  1. It will append 0 to the end of the list