if..else..结构:
eg1.
# 输入用户名密码,进行校验,并显示校验结果import getpass _name = "boreas" _pw = "super123" name = input("name:") pw = getpass.getpass("password:") if _name == name and _pw == pw: print("you login on success!") else: print("you login on bad!")输入正确:name:boreaspassword:you login on success!输入错误:name:zhangsanpassword:you login on bad!
时间: 2024-10-05 14:09:37