How to get a the difference of two sets as a new set in Python

1 Answer

0 votes
s1 = {"a", "b", "c", "d", "e"}
s2 = {"c", "e"}

s3 = s1.difference(s2)

print(s3)


'''
run:

{'a', 'b', 'd'}

'''

 



answered Dec 9, 2017 by avibootz

Related questions

1 answer 163 views
3 answers 241 views
1 answer 157 views
1 answer 107 views
1 answer 148 views
1 answer 129 views
...