DEV Community

loading...

Discussion on: Daily Challenge #273 - Remove Duplicates

Collapse
gwelr profile image
Grégoire Welraeds

is
[3, 4, 6]
not
[4, 6, 3]
which is the expected answer

Collapse
maskedman99 profile image
Rohit Prasad

Fixed it

def Remove(duplicate):
    final = []

    for i in range(len(duplicate)):
        if duplicate[i] not in duplicate[i+1:]:
            final.append(duplicate[i])

    return final

x = input("Enter the integers: ")
x = x.split()

print(Remove(x))