【新手求解】为什么这里i是not defined?我要怎么改才能使结果为[1,9,2,3]?

 

def unify(a,b):

    return [[x,y] for x ,y in zip(a,b)]

print(unify([1,2],[9,3]))

def unify(a,b):
    return [cl[i] for i in range(len(a)) for cl in (a,b)]
print(unify([1,2],[9,3]))

 

解法上面已经给出了, and 是逻辑运算符,逻辑与,表示并且的意思, 一般用在判断中

还有 逻辑非:not

逻辑或:or