学习python 基础密码验证

break  #跳出整个循环
continue #跳出本次循环

简单密码验证
#!/usr/bin/env python
# -*- coding:utf-8 -*-

user = "long"
pwd ="abclong"

user_name = input("username:")
password = input("password:")

'''if user_name == user:
print("user ok...")
if password == pwd:
print("welcom login...")
else:
print("password error!")
else:
print("user name enter error! ")'''
#优化版
if user_name == user and password == pwd:
print("Welcome login ...")
else:
posted @ 2017-07-18 16:27  Novicelong  阅读(219)  评论(0编辑  收藏  举报