kyu_5.directions_reduction package

Submodules

kyu_5.directions_reduction.directions_reduction module

Solution for -> Directions Reduction.

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

kyu_5.directions_reduction.directions_reduction.check_pairs(arr: list) bool[source]

Check conditions for pairs.

Return False if any pairs were removed. Return True if there was nothing to remove. :param arr: list :return: bool

kyu_5.directions_reduction.directions_reduction.del_directions(i: int, arr: list) None[source]

Remove directions from the list of direction.

Parameters:
  • i – int

  • arr – list

Returns:

None

kyu_5.directions_reduction.directions_reduction.dir_reduc(arr: list) list[source]

Directions Reduction.

A function dir_reduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

The Haskell version takes a list of directions with data Direction = North | East | West | South. :param arr: list :return: list

kyu_5.directions_reduction.test_directions_reduction module

Test for -> Directions Reduction.

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

class kyu_5.directions_reduction.test_directions_reduction.DirectionsReductionTestCase(methodName='runTest')[source]

Bases: TestCase

Testing dir_reduc function.

_classSetupFailed = False
_class_cleanups = []
test_directions_reduction = None
test_directions_reduction_0(**kw)

dir_reduc function test suite [with test_array=[‘NORTH’, ‘SOUTH’, ‘SOUTH’, ‘EAST’, ‘WEST’, ‘NORTH’, ‘WEST’], expected=[‘WEST’]].

Test a function dir_reduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

The Haskell version takes a list of directions with data Direction = North | East | West | South.

The Clojure version returns nil when the path is reduced to nothing.

The Rust version takes a slice of enum Direction {NORTH, SOUTH, EAST, WEST}. :return:

test_directions_reduction_1(**kw)

dir_reduc function test suite [with test_array=[‘NORTH’, ‘WEST’, ‘SOUTH’, ‘EAST’], expected=[‘NORTH’, ‘WEST’, ‘SOUTH’, ‘EAST’]].

Test a function dir_reduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

The Haskell version takes a list of directions with data Direction = North | East | West | South.

The Clojure version returns nil when the path is reduced to nothing.

The Rust version takes a slice of enum Direction {NORTH, SOUTH, EAST, WEST}. :return:

test_directions_reduction_2(**kw)

dir_reduc function test suite [with test_array=[‘NORTH’, ‘EAST’, ‘NORTH’, ‘EAST…’EAST’, ‘EAST’, ‘WEST’, ‘SOUTH’], expected=[‘NORTH’, ‘EAST’]].

Test a function dir_reduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

The Haskell version takes a list of directions with data Direction = North | East | West | South.

The Clojure version returns nil when the path is reduced to nothing.

The Rust version takes a slice of enum Direction {NORTH, SOUTH, EAST, WEST}. :return:

test_directions_reduction_3(**kw)

dir_reduc function test suite [with test_array=[‘EAST’, ‘NORTH’, ‘SOUTH’, ‘NORT…WEST’, ‘EAST’, ‘SOUTH’, ‘SOUTH’], expected=[‘EAST’, ‘SOUTH’, ‘SOUTH’, ‘SOUT…ORTH’, ‘WEST’, ‘SOUTH’, ‘SOUTH’]].

Test a function dir_reduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

The Haskell version takes a list of directions with data Direction = North | East | West | South.

The Clojure version returns nil when the path is reduced to nothing.

The Rust version takes a slice of enum Direction {NORTH, SOUTH, EAST, WEST}. :return:

test_directions_reduction_4(**kw)

dir_reduc function test suite [with test_array=[‘WEST’, ‘NORTH’, ‘EAST’, ‘EAST’…ORTH’, ‘NORTH’, ‘SOUTH’, ‘EAST’], expected=[‘WEST’, ‘NORTH’, ‘NORTH’, ‘EAST’]].

Test a function dir_reduc which will take an array of strings and returns an array of strings with the needless directions removed (W<->E or S<->N side by side).

The Haskell version takes a list of directions with data Direction = North | East | West | South.

The Clojure version returns nil when the path is reduced to nothing.

The Rust version takes a slice of enum Direction {NORTH, SOUTH, EAST, WEST}. :return:

Module contents

Directions Reduction.