题解 | #禁止重复注册#

禁止重复注册

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!')

全部评论

相关推荐

2025-12-01 20:05
宁波职业技术学院 C++
点赞 评论 收藏
分享
牛至超人:哈工大已经很棒了,不需要加括号了,然后咋没有实习经历呢?火速趁寒假整一段实习,导师不让就狠狠肘击
投了多少份简历才上岸
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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