这可能是一个重复的问题:
如何更简洁地查找缺失值? 用Python语言表达字母表a、b、c上的可交换运算符T是否有优雅的方式,其中:
如何更简洁地查找缺失值? 用Python语言表达字母表a、b、c上的可交换运算符T是否有优雅的方式,其中:
a T b == c
b T c == a
c T a == b
def T(first, second):
if first is 'a' and second is 'b':
return 'c'
if first is 'a' and second is 'c':
return 'c'
if first is 'b' and second is 'c':
return 'a'
if first is 'b' and second is 'a':
return 'c'
if first is 'c' and second is 'a':
return 'b'
if first is 'c' and second is 'b':
return 'a'
i,j
,都有i T j == j T i
。三元的:“在字母表a,b,c
上”。 - Randomblue