-
Code from random import getrandbits def RandomBool(): return bool(getrandbits(1))
Test Cases import codewars_test as test from solution import RandomBool .describe("Example") def test_group(): .it("test case") def test_case(): test.assert_equals(RandomBool() in [True, False], True)
Output:
-
Code - from random import getrandbits
class RandomBool(object):def __init__(self):self.b = bool(getrandbits(1))def __repr__(self):return f'{self.b}'- def RandomBool():
- return bool(getrandbits(1))
Test Cases - import codewars_test as test
- from solution import RandomBool
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
test.assert_equals(RandomBool().b in [True, False], True)- test.assert_equals(RandomBool() in [True, 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 }}