what is the difference between these two codes, why is the output different


add a print statement after your for loop in your first function:

for Item in Items:
    print Item

see how Item contains the entire string? Your list only contains one item, a string

to solve this, on line 1 change the list so it contains multiply strings:

y = ["a","b","c","a"]


ok so
def remove_duplicates(Items):

for Item in Items:

    if Item not in ItemsNoDuplicates:


return ItemsNoDuplicates

print remove_duplicates(["p","d","e","p"])
print remove_duplicates(["p,d,p,p"])

both the print statements are viewed differently by python.... it indexes the entire string as 1 in second print statement and seperately in first.
if i were to get printout of second i may have to loop the function again..or even split ...! the entire string with .split()


you understand the difference? for ["p,d,p,p"], there is simply 1 item in the list (a string), the , are simply part of the string, and not separating elements in list, so yes, you would need split(",")


yes.... i did thank you..