题解 | #禁止重复注册#
禁止重复注册
https://www.nowcoder.com/practice/43acd439112c4b85a9168ad3dd7e2bd1
#重点是两个列表中的名字大小写不同,要转化成同样是小写进行比较 current_users=['Niuniu','Niumei','GURR','LOLO']#存在用户 new_users=['GurR','Niu Ke Le','LoLo','Tuo Rui Chi']#新用户 current=[a.lower() for a in current_users]#存在用户转成小写 for i in new_users: if i.lower() in current:#新用户转成小写来进行比较 print('The user name',i,'has already been registered! Please change it and try again!') else:print('Congratulations, the user name',i,'is available!')