List Subtraction

    0

    0

    Mahendra Kumar

    ListDSAbeginner

    Python program for Subtraction Between Two Lists

    # take list
    a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    b = [1, 3, 4, 7, 9]
    # print original list
    print('list1 =', a)
    print('list2 =', b)
    # subtraction of list
    sub = list(set(a) - set(b))
    # print subtraction value
    print('list1 - list2 =', sub)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.