← Back to challenges

Not Not Not True

PythonHardlogicvalidation

Instructions

Something which is not true is false, but something which is not not true is true! Create a function where given n number of "not", evaluate whether it's True or False.

Examples

not_not_not(1, True) ➞ False
# Not True.

not_not_not(2, False) ➞ False
# Not not False.

not_not_not(6, True) ➞ True
# Not not not not not not True.

Notes

Even though this challenge can be easily solved through the use of an if | else block, you might want to solve it through the use of a Boolean Logic Operator or a Bitwise Operator, taking the opportunity to become acquainted with these methods.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: How Many Decimal Places?