kyu_5.first_non_repeating_character package

Submodules

kyu_5.first_non_repeating_character.first_non_repeating_letter module

kyu_5.first_non_repeating_character.first_non_repeating_letter.first_non_repeating_letter(string: str) → str[source]

A function named first_non_repeating_letter that takes a string input, and returns the first character that is not repeated anywhere in the string. :param string: :return:

kyu_5.first_non_repeating_character.test_first_non_repeating_letter module

class kyu_5.first_non_repeating_character.test_first_non_repeating_letter.FirstNonRepeatingLetterTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing first_non_repeating_letter function

test_first_non_repeating_letter()[source]

Testing a function named first_non_repeating_letter that takes a string input, and returns the first character that is not repeated anywhere in the string.

For example, if given the input ‘stress’, the function should return ‘t’, since the letter t only occurs once in the string, and occurs first in the string.

As an added challenge, upper- and lowercase letters are considered the same character, but the function should return the correct case for the initial letter. For example, the input ‘sTreSS’ should return ‘T’.

If a string contains all repeating characters, it should return an empty string (“”) or None – see sample tests. :return:

Module contents