Ordered List Set Difference Calculator

  • Share this:

Code introduction


Compute the set difference between two ordered lists, which includes elements present in the first list but not in the second list.


Technology Stack : Set (set)

Code Type : Function

Code Difficulty : Intermediate


                
                    
def aordiff(arg1, arg2):
    """
    计算两个有序列表的差集。

    :param arg1: 第一个有序列表
    :param arg2: 第二个有序列表
    :return: 第一个列表中存在于第一个列表但不存在于第二个列表中的元素组成的列表
    """
    return list(set(arg1) - set(arg2))                
              
Tags: