[Solved] How to check the distinct number of characters in a string [closed]


You can do something like this:

text="Hello this is a test"

unique_letters = set(text.lower())
unique_letters.remove(' ')

print(unique_letters)

print ('odd') if len(unique_letters) % 2 else print ('even')

Result:

{'o', 'h', 'e', 'l', 'i', 's', 'a', 't'}
even

0

solved How to check the distinct number of characters in a string [closed]