Feb-06-2022, 07:55 PM
(This post was last modified: Feb-08-2022, 06:19 AM by Yoriz.
Edit Reason: Added code tags
)
Hi there
Can somebody explain why my statement for c also results in a list and not in a set (as the set brackets where used)?
(This is just to understand what is actually happening - I'm not interested in other ways to do it ;-)
Can somebody explain why my statement for c also results in a list and not in a set (as the set brackets where used)?
(This is just to understand what is actually happening - I'm not interested in other ways to do it ;-)
a = [5, 5, 1, 45, 3] b = [3, 8, 92, 5, 45, 6] c = sorted({x for x in a if x in b}) d = sorted([x for x in a if x in b])