题解 | #禁止重复注册#

current_users = ['Niuniu','Niumei','GURR','LOLO']
current_users1 = [x.lower() for x in current_users]


new_users = ['GurR','Niu Ke Le','LoLo','Tuo Rui Chi']
new_users1 = [x.lower() for x in new_users] 

result1 = [1 if x in current_users1  else 0 for x in new_users1 ]

for i in range(len(result1)):
    if result1[i] == 1:
        print('The user name',new_users[i] ,'has already been registered! Please change it and try again!')
    else:
        print('Congratulations, the user name',new_users[i],'is available!')

全部评论

相关推荐

10-07 20:48
门头沟学院 Java
听说改名就会有offer:可能是实习上着班想到后面还要回学校给导师做牛马,看着身边都是21-25的年纪,突然emo了了
点赞 评论 收藏
分享
2 收藏 评论
分享
牛客网
牛客企业服务