Q12 If a= [1, 1, 2, 3, 3, 6,6,4). What is set(a)
Select one: :
a. Error
b. set([1, 2, 3, 6, 4])
c. set([1, 2, 3, 3, 6,6])
d. set([1, 1, 2, 3, 3, 6,6,4])
Answers
Answered by
3
Answer:
a. error
Explanation:
hope this helpful
Answered by
0
Answer:
The correct answer is an option(b)
b. set([1, 2, 3, 6, 4])
Explanation:
If a= [1, 1, 2, 3, 3, 6,6,4).
This statement indicates that a is a list that contains duplicate elements and it has a length of 8.
Now we find set(a), which means we are typecasting the list into the set(a). This will remove all the duplicate elements and contain only unique elements.
The main property of a set data structure is to remove the redundancy of the same elements. So by casting the list into a set, we have only one occurrence of all the elements.
And it becomes.
set([1,2,3,6,4])
Also, remember sets are mutable like the lists.
So option(b) becomes the correct answer.
#SPJ2
Similar questions