Ask Question
17 January, 06:31

Assume the list numbers1 has 100 elements, and numbers2 is an empty list. Write code that copies the values in numbers1 to numbers2.

+1
Answers (1)
  1. 17 January, 09:55
    0
    numbers1 = [5]*100

    numbers2 = numbers1[:]

    print (numbers2)

    Explanation:

    We have used the Python programming language to solve this problem. First we created a list to have 100 elements line 1, numbers1 = [5]*100, This statement creates a list that has 100 elements (the integer 5). In line two, we assign the elements in the the first list to the second list numbers2, notice the full colon in the statement numbers2 = numbers1[:], This allows the elements of the first list to be copied into the second list and on line 3, we printout the the second list.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assume the list numbers1 has 100 elements, and numbers2 is an empty list. Write code that copies the values in numbers1 to numbers2. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers