我正在尝试创建一个用户登录系统程序。我试图确保密码必须至少有 10 个字符,我已经完成了,但我无法确保它至少有两个数字,并且只能作为特殊字符使用下划线。我看过一些关于数字的解决方案,但我没有得到它们,而且它们很少有至少 2 位数字。
这是我的代码:
print("Welcome ")
print('')
print('New users should enter Sign to create an account')
print('')
print('')
username = input('Enter your Username: ')
if username == 'Sign':
while True:
usernames = ['Dave','Alice','Chloe']#A list that stores usernames
create_user = input('Enter your new username: ')
if create_user in usernames:
print('This user name has been taken .Try again')
continue
else:
break
usernames.append([create_user])
while True:
create_pass = input('Enter your your user password: ')
passwords = []#A list thst stores password
pass_len = len(create_pass)
if pass_len < 10:
print('Your password must be at least 10. Try again')
continue
else:
print('')
print('You are now a verified user.')
print('Run the application again to re-login.')
print('Thank You')
break
else:
password = input('Enter your password')
print('Visit www.bitly/p8?. to continue')
SMILET
呼啦一阵风
相关分类