-
Challenge: Write a function that takes an integer as input (number of candles on a birthday cake) and returns the number of ways the candles can be lit.
-
Explanation: A birthday cake with n candles can have 2^n different lighting combinations (all candles lit, none lit, some lit, etc.).
-
Example Test Cases:
birthdayCandles(2) => 4
birthdayCandles(4) => 16
def birthday_candles(candles):
return 2 ** candles
import codewars_test as test
from solution import birthday_candles
@test.describe("Example tests")
def example_tests():
@test.it('birthday_candles(1) = 2')
def test_1():
test.assert_equals(birthday_candles(1), 2)
@test.it('birthday_candles(2) = 4')
def test_2():
test.assert_equals(birthday_candles(2),4)
@test.it('birthday_candles(3) = 8')
def test_negative_odd():
test.assert_equals(birthday_candles(3), 8)