ropering / Study

0 stars 0 forks source link

[Python] difference #24

Open ropering opened 2 years ago

ropering commented 2 years ago
'''
차이가 있는 요소 값들을 리스트 자료형으로 반환한다.
'''

def difference(a, b):
    return [item for item in a if item not in b]

difference([1, 2, 3], [1, 2, 4])  # 3