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
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"]
for Item in Items: if Item not in ItemsNoDuplicates: ItemsNoDuplicates.append(Item) return ItemsNoDuplicates
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
yes.... i did thank you..