import codewars_test as test # TODO Write tests import solution # or from solution import example # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("test case") def test_case(): test.assert_equals(1 + 1, 2)
- import codewars_test as test
- # TODO Write tests
- import solution # or from solution import example
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
- test.assert_equals(1 + 1, 2)
def replicate(times, num): if times<=0: return [] else: return [num]+replicate(times-1,num) print(replicate(8,5))
- def replicate(times, num):
return [] if times <= 0 else [num] + replicate(times-1, num)replicate(8,5)- if times<=0:
- return []
- else:
- return [num]+replicate(times-1,num)
- print(replicate(8,5))