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.
14 Respuestas
+ 3
I prefer not to 😛
If u have a doubt i can help here
+ 3
Lol is this your homework? 😂😂 what language are u looking for?
+ 3
Since its your homework, I'll help you with algorithms, you work out the code... Or else you will never learn 🙁
+ 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))
+ 2
Here mate.. Just enter your string as input and submit.
https://code.sololearn.com/cYQ6B5rP85Dv/?ref=app
0
not running, mate!
0
can we chat privately mate? Facebook or its equivalent?
0
I'm a new programmer and there are other things I'd require your help
0
I'm a new programmer and there are other things I'd require your help
0
can you write that same code differently please?
0
can you write this same code differently please?
0
it's my homework actually and the language is python
0
I still have one more if you don't mind
0
ok... I'm watching this space