4 Comments
User's avatar
Debanjan Das's avatar

alternate solution using set operator -

list1 = [1, 2, 3, 4]

list2 = [3, 4, 5, 6]

list3=list1+list2

my_set = set(list3)

my_list=list(my_set)

print(my_list)

Expand full comment
Joaquin Anun's avatar

Your answer is not correct, it does not do what the assignment asks. You need to remove commn, not get the unique elements of both lists into one list. that code will return [1,2,3,4,5,6] and you need to remove 3 and 4 as they are common between both lists

Expand full comment
Ardit Sulce's avatar

True! Here is a solution that does that:

https://pastebin.com/raw/yQaSvsxY

Expand full comment
Joaquin Anun's avatar

Thnx for the reply Ardit, I made it work, just didn't want to post code that spoils the result.

Expand full comment