def sumi(arr=[0]): return sum(arr)
def sum(arr):if len(arr) == 1:return arr[0]else:return list(map(lambda x: x + x, arr))[-1]- def sumi(arr=[0]):
- return sum(arr)
import codewars_test as test from solution import sumi # test.assert_equals(actual, expected, [optional] message) @test.describe("Example tests") def test_group(): @test.it("Basic tests") def test_case(): test.assert_equals(sumi([1]), 1) test.assert_equals(sumi([1,2,3]), 6)
- import codewars_test as test
# TODO Write testsfrom solution import sum- from solution import sumi
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example tests")
- def test_group():
- @test.it("Basic tests")
- def test_case():
test.assert_equals(sum([1]), 1)test.assert_equals(sum([1,2,3]), 6)- test.assert_equals(sumi([1]), 1)
- test.assert_equals(sumi([1,2,3]), 6)