Python Progress

This commit is contained in:
Brian Buller 2017-08-13 09:25:58 -05:00
parent a9630f6ee8
commit e3178b57ad
5 changed files with 85 additions and 2 deletions

2
python/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Ignore compiled python tests
*.pyc

View File

@ -1,2 +1,9 @@
def is_isogram():
pass
def is_isogram(inp):
letList = []
for i in inp.lower():
if i.isalpha():
if not(i in letList):
letList.append(i)
else:
return False
return True

26
python/pangram/README.md Normal file
View File

@ -0,0 +1,26 @@
# Pangram
Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma,
"every letter") is a sentence using every letter of the alphabet at least once.
The best known English pangram is:
> The quick brown fox jumps over the lazy dog.
The alphabet used consists of ASCII letters `a` to `z`, inclusive, and is case
insensitive. Input will not contain non-ASCII symbols.
### 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/Pangram](https://en.wikipedia.org/wiki/Pangram)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

View File

@ -0,0 +1,2 @@
def is_pangram():
pass

View File

@ -0,0 +1,46 @@
import unittest
from pangram import is_pangram
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
class PangramTests(unittest.TestCase):
def test_sentence_empty(self):
self.assertFalse(is_pangram(''))
def test_pangram_with_only_lower_case(self):
self.assertTrue(
is_pangram('the quick brown fox jumps over the lazy dog'))
def test_missing_character_x(self):
self.assertFalse(
is_pangram('a quick movement of the enemy will '
'jeopardize five gunboats'))
def test_another_missing_character_x(self):
self.assertFalse(
is_pangram('the quick brown fish jumps over the lazy dog'))
def test_pangram_with_underscores(self):
self.assertTrue(
is_pangram('the_quick_brown_fox_jumps_over_the_lazy_dog'))
def test_pangram_with_numbers(self):
self.assertTrue(
is_pangram('the 1 quick brown fox jumps over the 2 lazy dogs'))
def test_missing_letters_replaced_by_numbers(self):
self.assertFalse(
is_pangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog'))
def test_pangram_with_mixedcase_and_punctuation(self):
self.assertTrue(is_pangram('"Five quacking Zephyrs jolt my wax bed."'))
def test_upper_and_lower_case_versions_of_the_same_character(self):
self.assertFalse(
is_pangram('the quick brown fox jumped over the lazy FOX'))
if __name__ == '__main__':
unittest.main()