Input is a list, consistently lower or uppercase. Within the sequence, when sorted correctly, one letter is missing. The function should return the missing letter as string output. See code below, where you'll notice I'm halfway done having calculated the missing letter just for lowercase lists.
import string
def find_missing_letter(chars):
for letter in string.ascii_lowercase:
if letter not in chars:
return letter[0]
Test examples:
test.assert_equals(find_missing_letter(['a','b','c','d','f']), 'e')
test.assert_equals(find_missing_letter(['O','Q','R','S']), 'P')
Anyone know how to check regardless of letter case??
2 changes are required for your specification:
Determine your charset by checking for the type of the letters
chars
contains.Start your check from the character that is the head of
chars
- that way chacking forb, c, e
will result ind
and nota
.Should go like: