import math def power(num , p): # return round(math.exp(1)**(p*math.log(num))) # return 10**(p*math.log(num,10)) return 2**(p*math.log(num,2))
- import math
- def power(num , p):
return num**p- # return round(math.exp(1)**(p*math.log(num)))
- # return 10**(p*math.log(num,10))
- return 2**(p*math.log(num,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("Check:") def test_group(): @test.it("Some simple cases") def test_case(): test.assert_equals(power(2,5), 2**5) # test.assert_equals(power(3,50), 3**50) test.assert_equals(power(2,200), 2**200)
- import codewars_test as test
- # TODO Write tests
- import solution # or from solution import example
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Check:")
- def test_group():
- @test.it("Some simple cases")
- def test_case():
- test.assert_equals(power(2,5), 2**5)
test.assert_equals(power(3,50), 3**50)- # test.assert_equals(power(3,50), 3**50)
- test.assert_equals(power(2,200), 2**200)