kyu_8.enumerable_magic_25 package

Submodules

kyu_8.enumerable_magic_25.take module

Solution for -> Enumerable Magic #25 - Take the First N Elements.

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

kyu_8.enumerable_magic_25.take.take(arr: list, n: int) list[source]

‘take’ function.

Accepts a list/array and a number n, and returns a list/array of the first n elements from the list/array.

Parameters:
  • arr – list

  • n – int

Returns:

list

kyu_8.enumerable_magic_25.test_take module

Test for -> Enumerable Magic #25 - Take the First N Elements.

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

class kyu_8.enumerable_magic_25.test_take.TakeTestCase(methodName='runTest')[source]

Bases: TestCase

Testing ‘take’ function.

_classSetupFailed = False
_class_cleanups = []
test_take = None
test_take_0(**kw)

Testing the function with various test data [with arr=[0, 1, 2, 3, 5, 8, 13], n=3, expected=[0, 1, 2]].

Returns:

test_take_1(**kw)

Testing the function with various test data [with arr=[51], n=35, expected=[51]].

Returns:

test_take_2(**kw)

Testing the function with various test data [with arr=[], n=3, expected=[]].

Returns:

test_take_3(**kw)

Testing the function with various test data [with arr=[0, 1, 2, 3, 5, 8, 13], n=0, expected=[]].

Returns:

Module contents

Enumerable Magic #25 - Take the First N Elements.