for the code example on “raise exceptions conditionally using assert statements”, shouldn’t the code be:
def calculate_square_root(number):
assert number <= 0, ‘Cannot…’
…
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Challenge Information:
Understanding Error Handling - What Is the Raise Statement and How Does It Work?
The assert statement tests to see if the condition is true. If it’s not, the error message is displayed. I agree that this was not clear from the lecture. Please consider opening a GitHub issue for this:
Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.