+ 1
temp = -10 assert (temp >= 0), "Colder than absolute zero!"
Here why the second argument is not in the parentheses , why it is important to write outside the parentheses ?
1 ответ
+ 4
assert is not a function, but a keyword, and they have their own syntax.
You also don't need the first set of parentheses, it's enough to just write the expression, and then the error string.
It's basically a shortcut for this:
if temp < 0:
raise AssertionError(
'Colder than absolute zero!'
)