Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test if TEXT is an isogram, using Python
def is_isogram(text, case_sensitive=False):
"""Test if TEXT is an isogram"""
if type(text) is not str:
return False
if not text:
return True
unique = set(text if case_sensitive else text.casefold())
return len(text) == len(unique)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment