你的位置:首页 > ASP.net教程

[ASP.net教程]菜鸟生活(python)之if判断


#! usr/bin/env python
#!-*-conding:utf-8-*-
#第一步:定义变量 name = 'python' passwd = 'password'
#第二步:写while循环 定义count=0
#第三步:判断count=3则打印print("Account Be Locked!!Please Change User")并跳出程序break
#第四步:用input模块和用户交互
#第五步:if判断用户输入是否何定义变量的值相同,用户名和密码匹配则打印Welcome Login...并跳出程序break
#第六步:if判断用户输入和定义用户和密码不匹配则循环三次退出程序
name = 'python'
passwd = 'password'
count = 0
while True:
if count == 3:
print("Account Be Locked!!Please Change User")
break
username =input("Please input your name :")
password =input("Please input your password:")
if username == name and password == passwd:
print("Welcome Login...")
break
else:
print("Login falied ,Please again Try...Thank you!")
count +=1