确定整数是否在其他两个整数之间? [英] Determine Whether Integer Is Between Two Other Integers?

查看:64
本文介绍了确定整数是否在其他两个整数之间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定给定的整数是否介于其他两个整数之间(例如,大于/等于 10000 且小于/等于 30000)?

How do I determine whether a given integer is between two other integers (e.g. greater than/equal to 10000 and less than/equal to 30000)?

我使用的是 2.3 IDLE 并且到目前为止我尝试的方法不起作用:

I'm using 2.3 IDLE and what I've attempted so far is not working:

if number >= 10000 and number >= 30000:
    print ("you have to pay 5% taxes")

推荐答案

if 10000 <= number <= 30000:
    pass

有关详细信息,请参阅文档.

For details, see the docs.

这篇关于确定整数是否在其他两个整数之间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆