コード例 #1
0
def test_answer():
    flattener = arrayFlattener()

    array = [[1,2,[3, [5, [8, 9],7, [[6]]]]],4]
    flattened = flattener.flatten(array)
    print(flattened)
    assert flattened == [1,2,3,5,8,9,7,6,4]
コード例 #2
0
def test_answer():
    flattener = arrayFlattener()

    array = [[1,2,['hello']],4]
    flattened = flattener.flatten(array)
    print(flattened)
    assert flattened == [1,2,'hello',4]
コード例 #3
0
def test_answer():
    flattener = arrayFlattener()

    array = [[1, 2, [3, {'key': 'val'}]], 4]
    flattened = flattener.flatten(array)
    print(flattened)
    assert flattened == [1, 2, 3, {'key': 'val'}, 4]