import datetime
today = datetime.date.today()
username = 'kelly'
password = ''
num = 0
while num < 3:
user = input('请输入用户名:')
passw = input('请输入密码:')
if username == user and password == passw:
print('{},欢迎登陆,今天的日期是{},程序结束'.format(username,today))
break
elif user == '' or passw == '':
print('用户密码不能为空')
else:
print('用户名/密码输入错误')
num += 1
else:
print('失败次数过多')
import datetime
username = 'kelly'
password = ''
today = datetime.date.today()
for i in range(3):
user = input('请输入用户名:')
passw = input('请输入密码')
if user=='' or passw=='':
print('用户名密码不能为空')
elif user==username and passw==password:
print('{},欢迎登陆,今天的日期是{},程序结束'.format(username,today))
break
else:
print('用户名密码输入错误')
else:
print('输入次数过多')