要求:输入用户名和密码,超过三次不正确退出
#!/usr/bin/env python
# -*- coding: utf-8 -*-
name ='david'
passwd ='haodf666'
count =0
while count <3:
n =input("please input your name: ")
p =input("please input your password: ")
if name == nand passwd == p:
print("welcome to U")
break
else:
print("__your name or passwd is wrong__")
count +=1
else:
print("###### you tried too many times .good bye ######")
网友评论