136k views
2 votes
Type the program's output

user_values = [3, 6, 7]
user_values
[0] = user_values [2]
user_values [2] = user_values [1]
print (user_values)

I don’t necessarily want the answer but I want an explanation on how to solve bc I don’t understand which numbers it wants me to select and why.

User Davidbe
by
7.5k points

1 Answer

2 votes

The program is asking you to assign the value of the third element in the list (7) to the first element in the list (3). Then, it is asking you to assign the value of the second element in the list (6) to the third element in the list (7). After that, it is asking you to print the list.

So, the output of the program should be [7, 6, 6].
User Jonathon Hibbard
by
7.9k points

No related questions found