Menu

gitpiper

union python Code Snippet in 2024

listbeginner

Last Updated: 16 June 2024

Returns every element that exists in any of the two lists once.

  • Create a set with all values of a and b and convert to a list.
def union(a, b): return list(set(a + b))
union([1, 2, 3], [4, 3, 2]) # [1, 2, 3, 4]

python snippet similar to union For You in June 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️