Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

symmetric_difference() Function of sets in python

# The symmetric_difference() function can be used to create a new set containing
# the symmetric differences of two sets.

mySet = {1, 2, 3, 4}
mySet2 = {3, 4, 5, 6}
mySet3 = mySet.symmetric_difference(mySet2)
print(mySet3)

# Output:
# {1, 2, 5, 6}
Comment

How to Get the Symmetric Difference of Sets in Python

firstSet = {2, 3, 4, 5}

secondSet = {1, 3, 5, 7}

print(firstSet ^ secondSet)
# {1, 2, 4, 7}
Comment

PREVIOUS NEXT
Code Example
Python :: keras name model 
Python :: automl classification tutorial sklearn 
Python :: prolog finding the max from a list of facts 
Python :: flask add_url_rule 
Python :: create array numpy 
Python :: python find dir 
Python :: image data generator keras with tf.data.Data.from_generator 
Python :: python conditionals 
Python :: reshape SAS matrix 
Python :: how to use pyttsx3 
Python :: python secret 
Python :: how to add array and array in python 
Python :: is str in pzthon 
Python :: what does enumerate do in python 
Python :: how to start coding in python 
Python :: how to declare a lambda function in python 
Python :: deleting a tuple in python 
Python :: define event on socketio python 
Python :: only split from third delimiter python 
Python :: typeerror: 
Python :: www.pd.date_range 
Python :: matplot image axis 
Python :: pandas read csv with lists 
Python :: fix the debug_mode = false django 
Python :: how to print text in python 
Python :: additionner liste python 
Python :: class __call__ method python 
Python :: how to get parent model object based on child model filter in django 
Python :: django run command from code 
Python :: check if value in dictionary keys python dataframe 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =