プログラム例

#!/usr/bin/python3

print("'a' <  'b':", 'a' < 'b')
print("'a' >  'b':", 'a' > 'b')
print("'a' == 'b':", 'a' == 'b')
print("'a' != 'b':", 'a' != 'b', "\n")

print('"abc" < "def": ', "abc" < "def")
print('"abc" < "ab": ', "abc" < "ab")
print('"abc" <= "ab": ', "abc" <= "abc")
print('"abc" is "abc": ', "abc" is "abc", "\n")

a="abc"
b=a
print('1st   a is b: ', a is b)
print('1st   a is not b: ', a is not b)

a="xyz"
print('2nd   a is b: ', a is b)

a="abc"
print('3rd   a is b: ', a is b)

実行結果

'a' <  'b': True
'a' >  'b': False
'a' == 'b': False
'a' != 'b': True 

"abc" < "def":  True
"abc" < "ab":  False
"abc" <= "ab":  True
"abc" is "abc":  True 

1st   a is b:  True
1st   a is not b:  False
2nd   a is b:  False
3rd   a is b:  True