MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / flip_coin

Function flip_coin

example_code/item_023.py:53–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51import random
52
53def flip_coin():
54 if random.randint(0, 1) == 0:
55 return "Heads"
56 else:
57 return "Tails"
58
59def flip_is_heads():
60 return flip_coin() == "Heads"

Callers 2

flip_is_headsFunction · 0.85
flip_is_tailsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected