Tables
Data Structures
Given any positive interger num
, result should list of numbers from zero till num
For example
- def int_to_table(10) should return [0,1,2,3,4,5,6,7,8,9]
- def int_to_table(1) should return [0,1]
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(int_to_table(9), [0,1,2,3,4,5,6,7,8,9]) test.assert_equals(int_to_table(7), [0,1,2,3,4,5,6,7]) test.assert_equals(int_to_table(4), [0,1,2,3,4]) @test.it("edge case") def edge_case(): test.assert_equals(int_to_table(0), [0]) test.assert_equals(int_to_table(-5),[])
- 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(int_to_table(9), [0,1,2,3,4,5,6,7,8,9])
- test.assert_equals(int_to_table(7), [0,1,2,3,4,5,6,7])
- test.assert_equals(int_to_table(4), [0,1,2,3,4])
- @test.it("edge case")
- def edge_case():
- test.assert_equals(int_to_table(0), [0])
- test.assert_equals(int_to_table(-5),[])