Skip to content

Commit 1cc1953

Browse files
committed
Added isogram implementation
1 parent 1dd3f7f commit 1cc1953

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pygorithm/string/isogram.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Author: OMKAR PATHAK
2+
# Created On: 17th August 2017
3+
4+
def is_isogram(word):
5+
'''
6+
An isogram (also known as a "nonpattern word") is a logological term for a word
7+
or phrase without a repeating letter
8+
'''
9+
# Convert the word or sentence in lower case letters.
10+
clean_word = word.lower()
11+
# Make ann empty list to append unique letters
12+
letter_list = []
13+
for letter in clean_word:
14+
# If letter is an alphabet then only check
15+
if letter.isalpha():
16+
if letter in letter_list:
17+
return False
18+
letter_list.append(letter)
19+
20+
return True
21+
22+
def get_code():
23+
""" returns the code for the current class """
24+
import inspect
25+
return inspect.getsource(is_isogram)

0 commit comments

Comments
 (0)