Skip to content
Subhajit Sahu edited this page Mar 25, 2021 · 6 revisions

Counts no. of true values. 📰 📘

Can be used to implement one-hot / one-cold detector.


count(a, b, ...)
# a: 1st boolean
# b: 2nd boolean
from extra_boolean import count


count(True, True)
# 2

count(True, False)
# 1

count(True, True, True, False)
# 3           ^     ^     ^

count(False, True, False, False)
# 1                  ^


References

Clone this wiki locally