詹惠儿

2018-12-18   阅读量: 530

数据分析师 Python编程

python常用的运算函数(3)

扫码加入数据分析学习群

8. lt(a,b): - 此函数用于检查a是否小于b。如果a小于b则返回true,否则返回false。
操作 - a <b

9. le(a,b): - 此函数用于检查a是否小于或等于b。如果a小于或等于b,则返回true,否则返回false。
操作 - a <= b

10. eq(a,b): - 该函数用于检查a是否等于b。如果a等于b,则返回true,否则返回false。
操作 - a == b

# Python code to demonstrate working of

# lt(), le() and eq()

# importing operator module

import operator

# Initializing variables

a = 3

b = 3

# using lt() to check if a is less than b

if(operator.lt(a,b)):

print ("3 is less than 3")

else : print ("3 is not less than 3")

# using le() to check if a is less than or equal to b

if(operator.le(a,b)):

print ("3 is less than or equal to 3")

else : print ("3 is not less than or equal to 3")

# using eq() to check if a is equal to b

if (operator.eq(a,b)):

print ("3 is equal to 3")

else : print ("3 is not equal to 3")

添加CDA认证专家【维克多阿涛】,微信号:【cdashijiazhuang】,提供数据分析指导及CDA考试秘籍。已助千人通过CDA数字化人才认证。欢迎交流,共同成长!
0.0000 0 1 关注作者 收藏

评论(0)


暂无数据

推荐课程

推荐帖子