Why is this the answer?
What will be the value of values_copy
after we execute the following code:
values = [5, 4, 7, 8, 9, 3]
values_copy =
for v in values:
values_copy.append(v)
answer: answer = [5, 4, 7, 8, 9, 3]
Why is this the answer?
What will be the value of values_copy
after we execute the following code:
values = [5, 4, 7, 8, 9, 3]
values_copy =
for v in values:
values_copy.append(v)
answer: answer = [5, 4, 7, 8, 9, 3]
Hi!
In order to understand better what you mean, what did you expect the answer to be?
hello,
i did not know the answer. i just dont understand why that is the answer.
Hi @vonagoodpaster,
Just copy this code into your mission screen and add a print
statement at the end, to check the result:
values = [5, 4, 7, 8, 9, 3]
values_copy = []
for v in values:
values_copy.append(v)
print(values_copy)
You will see now that values_copy
has the following value:
[5, 4, 7, 8, 9, 3]
Now, according to the task, you have to create a new variable called answer
and assign to it the value of values_copy
:
answer = values_copy
Or, alternatively, in this code line you can assign to answer
directly the value of values_copy
:
answer = [5, 4, 7, 8, 9, 3]
Then submit the answer.