Skip to content

Instantly share code, notes, and snippets.

@paravar
Created September 27, 2017 16:13
Show Gist options
  • Save paravar/dcdb497e759a1fb19583021bfc74f8fa to your computer and use it in GitHub Desktop.
Save paravar/dcdb497e759a1fb19583021bfc74f8fa to your computer and use it in GitHub Desktop.
def is_isogram(string):
string_lower = string.lower()
for i in string_lower:
if not i.isalpha():
continue
for n in range(string_lower.index(i) - 1, string_lower.index(i) - len(string_lower), -1):
if string_lower[n] == i:
print("\"%s\" is not an isogram.") % (string)
return False
print("\"%s\" is an isogram!") % (string)
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment