[Tutor] Help on this assignment

Alan Gauld alan.gauld at yahoo.co.uk
Thu Feb 9 04:17:31 EST 2017


On 09/02/17 08:10, Sasiliyu Adetunji wrote:

> Write a function called remove_duplicates which will take one argument
> called string. This string input will only have characters between a-z.
> 
> The function should remove all repeated characters in the string and return
> a tuple with two values:
> 
> A new string with only unique, sorted characters.
> 
> The total number of duplicates dropp

You could use set() to remove the duplicates.
Then compare the lengths of the set with the length
of the original to determine how many letters were
dropped.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list