< does not support comparison between str instances and int instances
birth is of type str
2000 is of type int
Therefore, it cannot be compared, and an error is reported
1 birth = input('birth: ') 2 if birth < 2000: 3 print('00前') 4 else: 5 print('00后')
change into:
1 s = input('birth: ') 2 birth = int(s) 3 if birth < 2000: 4 print('00前') 5 else: 6 print('00后')