← Back to challenges

Flip the Boolean

PythonHardlogicconditionslanguage_fundamentals

Instructions

Create a function that reverses a boolean value and returns the string "boolean expected" if another variable type is given.

Examples

reverse(True) ➞ False

reverse(False) ➞ True

reverse(0) ➞ "boolean expected"

reverse(None) ➞ "boolean expected"
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Folding a Piece of Paper