你能做多个“if"吗?Python中的条件? [英] Can you make multiple "if" conditions in Python?

查看:28
本文介绍了你能做多个“if"吗?Python中的条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 JavaScript 中,可以这样做:

In JavaScript, one could do this:

if (integer > 3 && integer < 34){
    document.write("Something")
}

这在 Python 中可行吗?

Is this possible in Python?

推荐答案

Python 确实可以让你做这样的事情

Python indeed allows you to do such a thing

if integer > 3 and integer < 34

Python 也足够聪明来处理:

Python is also smart enough to handle:

if 3 < integer < 34:
    # do your stuff

这篇关于你能做多个“if"吗?Python中的条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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