-
FundamentalsRestricted
Code is_even=lambda*x:~x[False]&True
Test Cases import re import codewars_test as test import solution .describe('Check') def test_group(): .it('Submission Check') def check_code(): code = (re.sub('#.*', '', open('solution.py').read()).strip()) test.expect(not re.findall('\s|\d', code), 'Should not have a space nor any number') .describe('Test') def test_group(): .it('Even case') def is_even(): for i in range(0, 30, 2): test.assert_equals(solution.is_even(i), True) .it('Odd case') def is_even(): for i in range(1, 30, 2): test.assert_equals(solution.is_even(i), False)
Output:
-
Code is_even=lambda*x:not(x[False]&True)- is_even=lambda*x:~x[False]&True
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}