判断奇数和偶数:
#!/usr/bin/env python
# -*- coding:utf8 -*-
a = input("Please enter an integer:")
b = a % 2
if b == 0 :
print("You entered an even number")
else:
print("You entered an odd number")
判断用户名密码是否正确
#!/usr/bin/env python
# -*- coding:utf8 -*-
a = input("please enter username:")
b = input("please enter password:")
if a == "root1" and b == "123":
print("Congratulations on your successful login")
else:
print("please enter again!")