The challenge
Write a function that always returns 5
Sounds easy right? Just bear in mind that you can’t use any of the following characters: 0123456789*+-/
The solution in Python code
Option 1:
def unusual_five():
return len(['a','b','c','d','e'])
Option 2:
def unusual_five():
return len("five!")
Option 3:
def unusual_five():
return (int(True << True << True ^ True))
Option 4:
def unusual_five():
return "fiftyfive divided by eleven".count("e")
Test cases to validate our solution
import test
from solution import unusual_five
@test.describe("Fixed Tests")
def fixed_tests():
@test.it('Should return 5')
def basic_test_cases():
test.assert_equals(unusual_five(),5,"lol")