kyu_6.rotate_the_letters_of_each_element package

Submodules

kyu_6.rotate_the_letters_of_each_element.group_cities module

Solution for -> ROTATE THE LETTERS OF EACH ELEMENT.

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

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

Group cities.

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]

Rotate elements/chars.

Parameters:
  • item – str

  • element – str

Returns:

bool

kyu_6.rotate_the_letters_of_each_element.group_cities.sort_results(results: list) None[source]

Sorting results.

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

kyu_6.rotate_the_letters_of_each_element.test_group_cities module

Solution for -> ROTATE THE LETTERS OF EACH ELEMENT.

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

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

Bases: TestCase

Testing ‘group_cities’ function.

_classSetupFailed = False
_class_cleanups = []
test_group_cities = None
test_group_cities_0(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Tokyo’, ‘London’, ‘Rome’, ‘Donlon’, ‘Kyoto’, ‘Paris’, ‘Okyot’], expected=[[‘Kyoto’, ‘Okyot’, ‘Tokyo’], [’… ‘London’], [‘Paris’], [‘Rome’]]].

Make sure 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:

test_group_cities_1(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Tokyo’, ‘London’, ‘Rome’, ‘Donlon’], expected=[[‘Donlon’, ‘London’], [‘Rome’], [‘Tokyo’]]].

Make sure 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:

test_group_cities_2(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Rome’, ‘Rome’, ‘Rome’, ‘Donlon’, ‘London’], expected=[[‘Donlon’, ‘London’], [‘Rome’]]].

Make sure 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:

test_group_cities_3(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Ab’, ‘Aa’], expected=[[‘Aa’], [‘Ab’]]].

Make sure 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:

test_group_cities_4(**kw)

Testing ‘group_cities’ function with various test data [with seq=[], expected=[]].

Make sure 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:

test_group_cities_5(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Bb’, ‘Cbacb’, ‘Bacaa’, ‘C’, ‘A’, ‘Bccab’, ‘Ba’], expected=[[‘A’], [‘Ba’], [‘Bacaa’], [‘Bb’], [‘Bccab’], [‘C’], [‘Cbacb’]]].

Make sure 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:

test_group_cities_6(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Abaa’, ‘Bc’, ‘Ca’, ‘Bbcac’, ‘C…, ‘A’, ‘C’, ‘Cba’, ‘Baa’, ‘Abc’], expected=[[‘Abc’, ‘Cab’], [‘A’], [‘Abaa’]…], [‘Caca’], [‘Cba’], [‘Cbbcc’]]].

Make sure 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:

test_group_cities_7(**kw)

Testing ‘group_cities’ function with various test data [with seq=[‘Ab’, ‘Aba’, ‘A’, ‘Bbab’, ‘Baa’…a’, ‘Bbbb’, ‘Ac’, ‘Bcbaa’, ‘Ab’], expected=[[‘Aba’, ‘Baa’], [‘A’], [‘Ab’], …], [‘Bbbb’], [‘Bcbaa’], [‘Cac’]]].

Make sure 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

ROTATE THE LETTERS OF EACH ELEMENT.