Unique Elements Finder

  • Share this:

Code introduction


This function takes two lists as input and returns a new list containing elements that are unique to either of the two lists.


Technology Stack : set

Code Type : List operation

Code Difficulty :


                
                    
def get_unique_elements(list1, list2):
    """
    获取两个列表中不重复的元素。
    """
    return list(set(list1) ^ set(list2))                
              
Tags: