Day 19_身分運算子 (Identity Operators)
19-1. is not
式子:
x = 1
y = 2
print(x is not y)
結果:
True
式子:
x = 1
y = 1
print(x is not y)
結果:
False
式子:
x = a
y = b
print(x is not y)
結果:
True
式子:
x = a
y = a
print(x is not y)
結果:
False
19-2. is
式子:
x = '1'
y = '1'
print(x is y)
結果:
True
式子:
x = '1'
y = '2'
print(x is y)
結果:
False
式子:
x = 'a'
y = 'a'
print(x is y)
結果:
True
式子:
x = 'a'
y = 'b'
print(x is y)
結果:
False