I want to check the following using assert
.
If: key mean
is in dictionary d
then it should have length equal to N
.
else: sigma
should not be None
.
What is the concise and pythonic way to write this assertion?
I tried this:
if "mean" in d:
assert len(d["mean"]) == N
else:
assert sigma is not None