New Fetch
This commit is contained in:
30
python/isogram/README.md
Normal file
30
python/isogram/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Isogram
|
||||
|
||||
Determine if a word or phrase is an isogram.
|
||||
|
||||
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter.
|
||||
|
||||
Examples of isograms:
|
||||
|
||||
- lumberjacks
|
||||
- background
|
||||
- downstream
|
||||
|
||||
The word *isograms*, however, is not an isogram, because the s repeats.
|
||||
|
||||
### Submitting Exercises
|
||||
|
||||
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
|
||||
|
||||
For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
|
||||
|
||||
|
||||
For more detailed information about running tests, code style and linting,
|
||||
please see the [help page](http://exercism.io/languages/python).
|
||||
|
||||
## Source
|
||||
|
||||
Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram)
|
||||
|
||||
## Submitting Incomplete Solutions
|
||||
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
2
python/isogram/isogram.py
Normal file
2
python/isogram/isogram.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def is_isogram():
|
||||
pass
|
39
python/isogram/isogram_test.py
Normal file
39
python/isogram/isogram_test.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import unittest
|
||||
|
||||
from isogram import is_isogram
|
||||
|
||||
|
||||
# test cases adapted from `x-common//canonical-data.json` @ version: 1.1.0
|
||||
|
||||
class TestIsogram(unittest.TestCase):
|
||||
|
||||
def test_empty_string(self):
|
||||
self.assertTrue(is_isogram(""))
|
||||
|
||||
def test_isogram_with_only_lower_case_characters(self):
|
||||
self.assertTrue(is_isogram("isogram"))
|
||||
|
||||
def test_word_with_one_duplicated_character(self):
|
||||
self.assertFalse(is_isogram("eleven"))
|
||||
|
||||
def test_longest_reported_english_isogram(self):
|
||||
self.assertTrue(is_isogram("subdermatoglyphic"))
|
||||
|
||||
def test_word_with_duplicated_character_in_mixed_case(self):
|
||||
self.assertFalse(is_isogram("Alphabet"))
|
||||
|
||||
def test_hypothetical_isogrammic_word_with_hyphen(self):
|
||||
self.assertTrue(is_isogram("thumbscrew-japingly"))
|
||||
|
||||
def test_isogram_with_duplicated_non_letter_character(self):
|
||||
self.assertTrue(is_isogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"))
|
||||
|
||||
def test_made_up_name_that_is_an_isogram(self):
|
||||
self.assertTrue(is_isogram("Emily Jung Schwartzkopf"))
|
||||
|
||||
def test_duplicated_character_in_the_middle(self):
|
||||
self.assertFalse(is_isogram("accentor"))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Reference in New Issue
Block a user