#方法一defcreateuser():fuhao = ['_', '*', '#']while(1):print('input username:')username = input()if username[0] > 'a'and username[0] < 'z':breakelse:print('username must begin with a-z')while(1):print('input password:')password = input()if password[0] < 'a'or password[0] > 'z':print('password must begin with a-z')elif(len(password) <= 6):print('the length of password must upper 6')elif((fuhao[0] notin password) and (fuhao[1] notin password) \and (fuhao[2] notin password)):print('''password must at least include one of '_', '*', '#' ''')elif(('0'notin password) and ('1'notin password) and ('2'notin\password) and ('3'notin password) and ('4'notin password) and\('5'notin password) and ('6'notin password) and ('7'notin\password) and ('8'notin password) and ('9'notin password)):print('password must at least one number')else:print('create successful!')break#方法二defcreateuser2():fuhao = ['_', '*', '#']while(1):print('input username:')username = input()if username[0] > 'a'and username[0] < 'z':breakelse:print('username must begin with a-z')while(1):print('input password:')password = input()if len(password) <= 6:print('the leghth of password must bigger than 6')err1 = 0err2 = 0for i in range(len(password)):if i == 0:if password[i] < 'a'or password[i] > 'z':print('password must begin with a-z')if password[i] in fuhao:err1 = 1if password[i] >= '0'and password[i] <= '9':err2 = 1if err1 == 0:print("""password must include at least one of '_', '*', '#'""")elif err2 == 0:print('password must at least include one of number')else:print('create successful!')break