kyu_6.row_of_the_odd_triangle package

Submodules

kyu_6.row_of_the_odd_triangle.odd_row module

Solution for -> Row of the odd triangle.

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

kyu_6.row_of_the_odd_triangle.odd_row.calc_first_number(n: int) int[source]

Calculate first number in the row.

Parameters:

n

Returns:

kyu_6.row_of_the_odd_triangle.odd_row.calc_last_number(n: int) int[source]

Calculate last number in the row.

Parameters:

n

Returns:

kyu_6.row_of_the_odd_triangle.odd_row.odd_row(n: int) list[source]

Odd row.

Given a triangle of consecutive odd numbers finds the triangle’s row knowing its index (the rows are 1-indexed). :param n: :return:

kyu_6.row_of_the_odd_triangle.test_odd_row module

Test for -> Row of the odd triangle.

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

class kyu_6.row_of_the_odd_triangle.test_odd_row.OddRowTestCase(methodName='runTest')[source]

Bases: TestCase

Testing odd_row function.

_classSetupFailed = False
_class_cleanups = []
test_odd_row = None
test_odd_row_0(**kw)

Testing odd_row function with various test data [with n=1, expected=[1]].

Returns:

test_odd_row_1(**kw)

Testing odd_row function with various test data [with n=2, expected=[3, 5]].

Returns:

test_odd_row_2(**kw)

Testing odd_row function with various test data [with n=13, expected=[157, 159, 161, 163, 165, 167, 1…9, 171, 173, 175, 177, 179, 181]].

Returns:

test_odd_row_3(**kw)

Testing odd_row function with various test data [with n=19, expected=[343, 345, 347, 349, 351, 353, 3…7, 369, 371, 373, 375, 377, 379]].

Returns:

test_odd_row_4(**kw)

Testing odd_row function with various test data [with n=41, expected=[1641, 1643, 1645, 1647, 1649, 1…1, 1713, 1715, 1717, 1719, 1721]].

Returns:

Module contents

Row of the odd triangle.