题解 | #禁止重复注册#

禁止重复注册

http://www.nowcoder.com/practice/43acd439112c4b85a9168ad3dd7e2bd1

current_users = ['Niuniu','Niumei','GURR','LOLO'] #将当前用户组用户名全部小写,方便比较 current_users = [user.lower() for user in current_users]

#新用户组 new_users = ['GurR','Niu Ke Le','LoLo','Tuo Rui Chi']

#遍历新用户组 for i in new_users: #如果新用户小写后发现存在于当前用户组中 if i.lower() in current_users: print(f'The user name {i} has already been registered! Please change it and try again!') else: print(f'Congratulations, the user name {i} is available!')

全部评论

相关推荐

兄弟们,实习都是在接各种api,该怎么包装简历
仁者伍敌:感觉我自己做小项目也是各种api啊,我要怎么包装简历
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务