kyu_5.first_non_repeating_character package

Submodules

kyu_5.first_non_repeating_character.first_non_repeating_letter module

Solution for -> First non-repeating character.

Created by Egor Kostan. GitHub: https://github.com/ikostan

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

first_non_repeating_letter function.

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

kyu_5.first_non_repeating_character.test_first_non_repeating_letter module

Test for -> First non-repeating character.

Created by Egor Kostan. GitHub: https://github.com/ikostan

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

Bases: TestCase

Testing first_non_repeating_letter function.

_classSetupFailed = False
_class_cleanups = []
test_first_non_repeating_letter = None
test_first_non_repeating_letter_0_a(**kw)

Testing a function named first_non_repeating_letter [with string=’a’, expected=’a’].

The function 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:

test_first_non_repeating_letter_1_stress(**kw)

Testing a function named first_non_repeating_letter [with string=’stress’, expected=’t’].

The function 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:

test_first_non_repeating_letter_2_moonmen(**kw)

Testing a function named first_non_repeating_letter [with string=’moonmen’, expected=’e’].

The function 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:

test_first_non_repeating_letter_3_(**kw)

Testing a function named first_non_repeating_letter [with string=’’, expected=’’].

The function 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:

test_first_non_repeating_letter_4_abba(**kw)

Testing a function named first_non_repeating_letter [with string=’abba’, expected=’’].

The function 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:

test_first_non_repeating_letter_5_aa(**kw)

Testing a function named first_non_repeating_letter [with string=’aa’, expected=’’].

The function 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:

test_first_non_repeating_letter_6__(**kw)

Testing a function named first_non_repeating_letter [with string=’~><#~><’, expected=’#’].

The function 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:

test_first_non_repeating_letter_7_hello_world_eh_(**kw)

Testing a function named first_non_repeating_letter [with string=’hello world, eh?’, expected=’w’].

The function 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:

test_first_non_repeating_letter_8_sTreSS(**kw)

Testing a function named first_non_repeating_letter [with string=’sTreSS’, expected=’T’].

The function 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:

test_first_non_repeating_letter_9_Go_hang_a_salami_I_m_a_lasagna_hog_(**kw)

Testing a function named first_non_repeating_letter [with string=”Go hang a salami, I’m a lasagna hog!”, expected=’,’].

The function 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

First non-repeating character.