File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 33
33
" text formatting"
34
34
]
35
35
},
36
+ {
37
+ "slug" : " isogram" ,
38
+ "difficulty" : 1 ,
39
+ "topics" : [
40
+ ]
41
+ },
36
42
{
37
43
"slug" : " pangram" ,
38
44
"difficulty" : 1 ,
Original file line number Diff line number Diff line change
1
+ def is_isogram (string ):
2
+ characters_lower = [c .lower () for c in string if c .isalpha ()]
3
+ return len (set (characters_lower )) == len (characters_lower )
Original file line number Diff line number Diff line change
1
+ def is_isogram ():
2
+ pass
Original file line number Diff line number Diff line change
1
+ import unittest
2
+ from isogram import is_isogram
3
+
4
+
5
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
6
+
7
+ class TestIsogram (unittest .TestCase ):
8
+
9
+ def test_empty_string (self ):
10
+ self .assertTrue (is_isogram ("" ))
11
+
12
+ def test_isogram_with_only_lower_case_characters (self ):
13
+ self .assertTrue (is_isogram ("isogram" ))
14
+
15
+ def test_word_with_one_duplicated_character (self ):
16
+ self .assertFalse (is_isogram ("eleven" ))
17
+
18
+ def test_longest_reported_english_isogram (self ):
19
+ self .assertTrue (is_isogram ("subdermatoglyphic" ))
20
+
21
+ def test_word_with_duplicated_character_in_mixed_case (self ):
22
+ self .assertFalse (is_isogram ("Alphabet" ))
23
+
24
+ def test_hypothetical_isogrammic_word_with_hyphen (self ):
25
+ self .assertTrue (is_isogram ("thumbscrew-japingly" ))
26
+
27
+ def test_isogram_with_duplicated_non_letter_character (self ):
28
+ self .assertTrue (is_isogram ("Hjelmqvist-Gryb-Zock-Pfund-Wax" ))
29
+
30
+ def test_made_up_name_that_is_an_isogram (self ):
31
+ self .assertTrue (is_isogram ("Emily Jung Schwartzkopf" ))
32
+
33
+
34
+ if __name__ == '__main__' :
35
+ unittest .main ()
You can’t perform that action at this time.
0 commit comments