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

查看:128
本文介绍了你能制作多个“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天全站免登陆