如果一个值介于两个其他值之间? [英] If a value is between two other values??

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

问题描述

好的你怎么做以及如果判断一个值是否介于其他值之间如

展开 | 选择 | 换行 | 行号

解决方案


ok你怎么做以及如果判断一个值是否介于其他值之间,如

展开 | 选择 | Wrap | 行号


< blockquote class =post_quotes>
10到20之间的值

展开 | 选择 | Wrap | 行号


我觉得我应该指出发布的代码实际上是不正确的,并且总是返回True。来吧,看看你是否能够想到任何的值> = 10 < = 20


对于10到20之间的值,你的逻辑应该更像...

展开 | 选择 | 换行 | 行号


ok how do you do and if statment to see if a value is between to other values such as

Expand|Select|Wrap|Line Numbers

解决方案

ok how do you do and if statment to see if a value is between to other values such as

Expand|Select|Wrap|Line Numbers


For value between 10 and 20

Expand|Select|Wrap|Line Numbers


I feel I should point out that the code posted was in fact incorrect, and will always return True. Go ahead, see if you can think of any value that doesn''t match either >= 10 or <= 20.

For a value between 10 and 20, your logic should be more like...

Expand|Select|Wrap|Line Numbers


这篇关于如果一个值介于两个其他值之间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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