kyu_6.rotate_the_letters_of_each_element package

Submodules

kyu_6.rotate_the_letters_of_each_element.group_cities module

kyu_6.rotate_the_letters_of_each_element.group_cities.group_cities(seq: list) → list[source]

A function that given a sequence of strings, groups the elements that can be obtained by rotating others, ignoring upper or lower cases.

In the event that an element appears more than once in the input sequence, only one of them will be taken into account for the result, discarding the rest.

Parameters

seq – Sequence of strings. Valid characters for those strings are uppercase and lowercase characters from the alphabet and whitespaces.

Returns

Sequence of elements. Each element is the group of inputs that can be obtained by rotating the strings.

kyu_6.rotate_the_letters_of_each_element.group_cities.rotate(item: str, element: str) → bool[source]
kyu_6.rotate_the_letters_of_each_element.group_cities.sort_results(results: list) → None[source]

Sort the groups deafeningly by size and in the case of a tie, by the first element of the group alphabetically. :param results: :return:

kyu_6.rotate_the_letters_of_each_element.test_group_cities module

class kyu_6.rotate_the_letters_of_each_element.test_group_cities.GroupCitiesTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing ‘group_cities’ function

test_group_cities()[source]

Test that a function that given a sequence of strings, groups the elements that can be obtained by rotating others, ignoring upper or lower cases.

In the event that an element appears more than once in the input sequence, only one of them will be taken into account for the result, discarding the rest. :return:

Module contents