关系比较运算符
![Python 关系比较运算符 学习-米宝教室](https://js.mbb180.com/wp-content/uploads/2022/08/1660317449-1-1024x668.png)
"""
关系比较运算符
"""
def test_func():
# !=
print(1 != 2) # true
print(1 != 1) # false
print('*' * 10) #IndentationError: unindent does not match any outer indentation level
# == 注意两个等号之间没有间隔
print(1 == 2) # false
print(1 == 1) # true
test_func()
这样写着会报错 print(‘*’ * 10),提示缩进错误
"""
关系比较运算符
"""
def test_func():
# !=
print(1 != 2) # true
print(1 != 1) # false
print('*' * 10)
# == 注意两个等号之间没有间隔
print(1 == 2) # false
print(1 == 1) # true
test_func()
这样就没毛病了 ,结果如下
![Python 关系比较运算符 学习-米宝教室](https://js.mbb180.com/wp-content/uploads/2022/08/1660318523-image-1024x547.png)
"""
关系比较运算符
"""
def test_func():
# !=
print(1 != 2) # true
print(1 != 1) # false
print('*' * 10)
# == 注意两个等号之间没有间隔
print(1 == 2) # false
print(1 == 1) # true
print('*' * 10)
# >=
# <=
print(1 >= 2) # false
print(1 <= 2) # true
test_func()
评论 (0)