Which of the following prints OhNo
with the assertion failure when the number is negative?
(Choose all that apply.)
A. assert n < 0: "OhNo"; B. assert n < 0, "OhNo"; C. assert n < 0 ("OhNo"); D. assert(n < 0): "OhNo"; E. assert(n < 0, "OhNo");
A, D.
An assertion consists of a boolean expression followed by an optional colon and message.
The boolean expression is allowed to be in parenthesis, but this is not required.
Therefore A and D are correct.