如何使用Python中的匹配检查两个变量值?
变量的检查值的一种方法是使用一个或两个匹配块,但是如何使用一个匹配块检查值,并检查变量值在python中与匹配块中的范围内,例如此代码:
somevalue=int(input("enter any number"))
if 10<somevalue<1000:
print("some message")
one way for check value of a variable is to use if or two match block but how to check the value with one match block and also check variable value to be in a range in python with match block, for example this code:
somevalue=int(input("enter any number"))
if 10<somevalue<1000:
print("some message")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为此代码是您编写的block的一个很好的选择。
这是您想要的吗?
I think this code is a good alternative to if block that you've written.
Is this something you were looking for?
这样的东西?匹配案例语句并不是要做这种类型的事情。
您想要的另一个可能性可能是:
Something like this? Match-case statements aren't really meant to do this type of thing.
Another possibility of what you're asking for could be: