其他分享
首页 > 其他分享> > 关系运算符

关系运算符

作者:互联网

一、关系运算符

关系运算符(关系运算符涉及到布尔类型):结果 :Ture False

 > ,<,>=,<= ,==, !=, is

 

a = 10

b = 23

print(a > b) 吗?

 

x = 'abf'

y = 'abd'

print(x==y)

print(x < y)  #比第一个,第一个成立,就是Ture

比较的是ASCII编码表

Eile Edit View Navigate Code Refactor 
python Projectl 'i 
x builtins.py 
Run 
1001s 
VCS Window 
Help 
pythonProject1 
96 
97 
98 
103 
101 
Run: 
'abf' 
'abd' 
print(x 
print(x < y) 
D: \ python\python.exe 
False 
False 
Process finished with exit code @

 

 

输入考试成绩,判断成绩是否在100到80之间?

score = float(input('输入分数:'))

print(80 <=score <= 100)

 

输入huawei 手机价格:

输入iPhone 手机价格:

判断是否价格相等?

huawel 
iphone = 
102 
103 
104 
' tfiAffrf&: 
print(huawei 
iphone) 
D:\python\python.exe C:/Users/zongzi/PycharmProjec 
ffiAffrtß: 
True 
Process finished with exit code O

 

标签:关系,运算符,print,80,Ture,输入
来源: https://www.cnblogs.com/zongziya/p/15790060.html