actually, without printing within function it's better - this way it can be used in different ways. And supplying string as argument is great
def remove_duplicates(item): ans = "".join(set(item)) ans_length = len(item) - len(ans) return (ans, ans_length) print(remove_duplicates('abccbafg')) # but also you can do dedup, length = remove_duplicates('abbafg') print('There just {} unique element'.format(length))
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs