Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 694 Bytes

codewar-3.md

File metadata and controls

25 lines (20 loc) · 694 Bytes

#codewars-isograms

Fuck,今天网站好像瘫痪了,跑不出结果

Describe:

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:

is_isogram("Dermatoglyphics" ) == true
is_isogram("aba" ) == false
is_isogram("moOse" ) == false # -- ignore letter case

Best Solution:

def is_isogram(string):
    return len(string) == len(set(string.lower()))

My Solution:

def is_isogram(string):
	return string == "".join(list(set(string.lower())))