📌  相关文章
📜  检查数字是偶数还是奇数 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:13.340000             🧑  作者: Mango

代码示例1
#check wheather a is odd or even
'''interactive mode
>>> 10%2
0....................False #(False==0)
>>> 5%2
1....................True  #(True==1)'''
#scriptive mode
a=int(input('enter:'))
if a%2:
    print("its odd")#solution gives true if 'a' value is even
else:
    print("its even")#solution gives false if 'a' value is odd 
print('hope it helped')
#output
#False
enter:100
its even
hope it helped
#even
enter:101
its odd
hope it helped