Skip to content

Instantly share code, notes, and snippets.

@abdulateef
Last active December 9, 2018 11:27
Show Gist options
  • Save abdulateef/516dbd27c10984f7f1b3e42679b7008d to your computer and use it in GitHub Desktop.
Save abdulateef/516dbd27c10984f7f1b3e42679b7008d to your computer and use it in GitHub Desktop.
Write a function which will take one string argument containing characters between a-z, and should remove all repeated characters (dupliactaes) in the string.
def remove_duplicates(string):
unique = ''.join(sorted(set(string)))
removed = len(string) - len(unique)
return unique, removed
print(remove_duplicates('accccount'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment