I am stuck at remove_duplicates

used the code given below to solve the problem and also got correct results from

nlist = []
def remove_duplicates(lst):
    for i in lst:
        if i in nlist:
    return nlist


W.r.t. to your code, You need to put nlist inside of the function so it does not get past values when CC tests,also get rid of break and use pass..
break will make your code get halt early.


everything you need to remove duplicates should be inside the function, this include nlist = [], otherwise, if you call the function multiply times, there will be left overs in nlist from earlier function calls

also, why do you have break? This will break the loop, why would you want this?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.