需要帮助Python多个数字VAR

时间:2019-11-18 11:10:36

标签: python

我需要做这样的事情:

black = ['1', '3', '5', '7']
white = ['8', '6', '4', '2']
x1 = int(input("type x1"))
x2 = int(input("type x2"))

y1 = int(input("type y1"))
y2 = int(input("type y2"))
if x1 == y1 == black and x2 == y2 == white:
    print("Typed Numbers Is True")

U如何使blackwhite成为多个数字? 如果我输入x1 = 1x2 = 2 以及y1=1x2= 2打印出我数字是否正确?

1 个答案:

答案 0 :(得分:1)

如果有条件,请尝试

if (x1 and y1 in black) and (x2 and y2 in white):
    print("Typed Numbers Is True")