主页
Python
Python assert 关键词
demo_ref_keyword_assert
运行 ❯
×
更改方向
保存代码
更改主题
x = "hello" #if condition returns True, then nothing happens: assert x == "hello" #if condition returns False, AssertionError is raised: assert x == "goodbye"
Traceback (most recent call last):
File "demo_ref_keyword_assert.py", line 5, in <module>
assert x == "goodbye"
AssertionError