+ 5
Python/javascript isogram
someone help me with the code to remove all repeating chars on a word: isogram and also prints the number of repeating values removed using functions maybe you can try and fix this but include the number of characters emitted https://code.sololearn.com/ck8vF7k2M4zx/?ref=app
2 Antworten
+ 1
# you can use set to quickly filter duplicates in a string
def isIsogram(word):
unique_letters = set(word)
length_difference = len(word)-len(unique_letters)
if length_difference == 0:
return (word,True)
else:
return (word,False,length_difference)
print(isIsogram('abcdefghi'))
print(isIsogram('aabbccdd'))