Anyone with an idea should get in please! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Anyone with an idea should get in please!

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 dropped.

9th Apr 2017, 5:59 PM
Obongekeme Udo
Obongekeme Udo - avatar
14 Answers
+ 3
I prefer not to 😛 If u have a doubt i can help here
9th Apr 2017, 6:43 PM
Shraddha
Shraddha - avatar
+ 3
Lol is this your homework? 😂😂 what language are u looking for?
9th Apr 2017, 6:54 PM
Shraddha
Shraddha - avatar
+ 3
Since its your homework, I'll help you with algorithms, you work out the code... Or else you will never learn 🙁
9th Apr 2017, 7:02 PM
Shraddha
Shraddha - avatar
+ 2
Here's a code in python that takes a string and returns sorted unique characters in that string and the number of characters dropped : def remove_duplicates(x): z = set(list(x)) return (''.join(sorted(z))) inputString = input() newString = remove_duplicates(inputString) print (newString, len(inputString)-len(newString))
9th Apr 2017, 6:18 PM
Shraddha
Shraddha - avatar
+ 2
Here mate.. Just enter your string as input and submit. https://code.sololearn.com/cYQ6B5rP85Dv/?ref=app
9th Apr 2017, 6:31 PM
Shraddha
Shraddha - avatar
0
not running, mate!
9th Apr 2017, 6:29 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
can we chat privately mate? Facebook or its equivalent?
9th Apr 2017, 6:38 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
I'm a new programmer and there are other things I'd require your help
9th Apr 2017, 6:46 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
I'm a new programmer and there are other things I'd require your help
9th Apr 2017, 6:46 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
can you write that same code differently please?
9th Apr 2017, 6:52 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
can you write this same code differently please?
9th Apr 2017, 6:53 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
it's my homework actually and the language is python
9th Apr 2017, 6:56 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
I still have one more if you don't mind
9th Apr 2017, 6:56 PM
Obongekeme Udo
Obongekeme Udo - avatar
0
ok... I'm watching this space
9th Apr 2017, 7:07 PM
Obongekeme Udo
Obongekeme Udo - avatar