检查的依据:奇数除2余1;偶数除2无余数
num = int(input("请输入一个整数:")) if num % 2 == 1: print(num,"是奇数") elif num % 2 == 0: if num / 2 == 0 and user_input % 2 == 0: print (num,"既不是奇数也不是偶数") else: print(num,"是偶数")
检查的依据:奇数除2余1;偶数除2无余数
num = int(input("请输入一个整数:")) if num % 2 == 1: print(num,"是奇数") elif num % 2 == 0: if num / 2 == 0 and user_input % 2 == 0: print (num,"既不是奇数也不是偶数") else: print(num,"是偶数")