Move History

Fork Selected
  • Fundamentals
    Code
    def numberprint(x):
        return int(''.join(map(lambda x: str(x), list(range(1, x + 1)) + list(range(x - 1, 0, -1)))))
    # harder to read but 1 line ¯\_(ツ)_/¯
    Preloaded Code
    def numberprint(x):
        return
    Test Cases
    import codewars_test as test
    from solution import numberprint
    
    @test.describe("Fixed Tests")
    def basic_tests():
        @test.it("Fixed tests")
        def fixed_tests():   
            test.assert_equals(numberprint(1), 1)
            test.assert_equals(numberprint(2), 121)
            test.assert_equals(numberprint(10), 12345678910987654321)
  • Code
    • def numberprint(x):
    • l1 = list(map(str, range(1, x + 1)))
    • l1.extend(l1[-2::-1])
    • return int(''.join(l1))
    • return int(''.join(map(lambda x: str(x), list(range(1, x + 1)) + list(range(x - 1, 0, -1)))))
    • # harder to read but 1 line ¯\_(ツ)_/¯