forked from OmkarPathak/pygorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathisogram.py
More file actions
34 lines (28 loc) · 747 Bytes
/
isogram.py
File metadata and controls
34 lines (28 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Author: OMKAR PATHAK
Created On: 17th August 2017
"""
import inspect
def is_isogram(word):
"""
An isogram (also known as a "nonpattern word")
is a logological term for a word or phrase
without a repeating letter
:param word: word to check
:return: bool
"""
# Make an empty list to append unique letters
letter_list = []
for letter in word.lower():
# If letter is an alphabet then only check
if letter.isalpha():
if letter in letter_list:
return False
letter_list.append(letter)
return True
def get_code():
"""
returns the code for the is_isogram function
:return: source code
"""
return inspect.getsource(is_isogram)