for 循环中的多个条件 if 函数

Multiple condition if fonction inside a for loop

我正在浏览 SO,但找不到解决问题的方法,所以我做了一个 post。

我尝试用内部有多个条件(至少 3 个)的 If 语句制作一个 For 循环,但它不起作用,我无法理解它...我尝试了很多东西但是没有接缝工作。

这是我的代码,经过简化,因为在我的实际代码中,a、b、c 和 d 的值是随机的:

    a=[1]
    b=[2]
    c=[3]
    d=[0,1,2,3,4,5,6,7,8]
    
    for i in d:
        if d>a and\
           d>b and\
           d>c:
            print("OK")
        else:
            print("not OK")

但无论我尝试什么,我总是得到这个输出:

not OK
not OK
not OK
not OK
not OK
not OK
not OK
not OK
not OK

感谢您的帮助

你是这个意思吗:

a = 1
b = 2
c = 3
d = [0, 1, 2, 3, 4, 5, 6, 7, 8]

for i in d:
    if i > a and i > b and i > c:
        print("OK")
    else:
        print("not OK")

not OK
not OK
not OK
not OK
OK
OK
OK
OK
OK

固定代码:

    a=1
    b=2
    c=3
    d=[0,1,2,3,4,5,6,7,8]
    
    for i in d:
        if i>a and\
           i>b and\
           i>c:
            print("OK")
        else:
            print("not OK")

输出

not OK
not OK
not OK
not OK
OK
OK
OK
OK
OK