An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case.
Example: (Input --> Output)
"Dermatoglyphics" --> true
"aba" --> false
"moOse" --> false (ignore letter case)
def is_isogram(string):
string=string.upper()
for i in range(len(string)):
print(string[i::])
if string[i] in string[i+1::]:
return False
return True'알고리즘 문제 > CodeWar' 카테고리의 다른 글
| Duplicate Encoder (0) | 2022.09.20 |
|---|---|
| Are they the "same"? (0) | 2022.09.20 |
| Reverse Words (1) | 2022.09.19 |
| Array.diff (0) | 2022.09.19 |
| Get the Middle Character (1) | 2022.09.19 |