Python双重条件if语句

时间:2018-09-02 15:26:25

标签: python function if-statement

我试图用单词AND满足if语句中的2个条件,但似乎不起作用。有什么不对?我基本上是想打印e1,e2和e3中最大的一个。

    if e1 > e2 AND e3:
          then print elapsed 1
    elif:
          e2>e3
          then print e2
    else:
          print e3

1 个答案:

答案 0 :(得分:0)

您需要说

if e1 > e2 and e1 > e3:
    print(e1)
elif e2 > e3:
    print(e2)
else:
    print(e3)

然后它将起作用。