+ 2
Python output - Why is set(a) == b?
Code is: a = [1,2,3,2] b = {1,2,3,2} print(set(a)) print(set(a) == b)
2 Answers
+ 3
Because b is a set.
A set does not contain any duplicates.
When defining b with curly braces, b is a set. a with Square brackets is a list.
So set(a) is equal to b
https://www.sololearn.com/Discuss/1733735/?ref=app
+ 2
"a" - the list;
"b" - set;
a != b;
the function "set" converts the list "a" to the set;
set(a) == b;
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2464/