Move History

Fork Selected
  • Code
    testFunction = lambda n: {19:21}.get(n,n)
    Test Cases
    import codewars_test as test
    # TODO Write tests
    import solution # or from solution import example
    
    # test.assert_equals(actual, expected, [optional] message)
    @test.describe("FixedCases")
    def fixedCases():
        @test.it("One plus one")
        def testCase():
            test.assert_equals(testFunction(1+1), 2)
        @test.it("nine plus ten")
        def testCase():
            test.assert_equals(testFunction(9+10), 21)
    
  • Code
    • testFunction = lambda n: 21 if n == 19 else n
    • testFunction = lambda n: {19:21}.get(n,n)