-
-
Save IndhumathyChelliah/d37e0dfbf38575cac1980de4bfc4f4ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s1={1,2,3,4,5} | |
s2={4,5,6,7,8} | |
# symmetric_difference by using ^ operator | |
s3=s1^s2 | |
print (s3) #Output: {1, 2, 3, 6, 7, 8} | |
s4=s1.symmetric_difference(s2) | |
print (s4) #Output:{1, 2, 3, 6, 7, 8} | |
#symmetric_difference_update() | |
print (s1.symmetric_difference_update(s2)) #Output: None | |
print (s1) #Output: {1, 2, 3, 6, 7, 8} | |
s2^=s1 | |
print (s2) #Output: {1,2,3} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment