Duplicate elimination

    0

    0

    Mahendra Kumar

    listDSAbeginner

    Python program to remove duplicates from list

    # take list
    my_list = [1, 2, 3, 1, 5, 3, 4, 2, 7]
    # printing original list
    print('List:', my_list)
    # removed duplicates item using native method
    new_list = []
    for i in my_list:
        if i not in new_list:
            new_list.append(i)
    # print list after item deletion
    print('New list:', new_list)
    
    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.