题解 | #禁止重复注册#
禁止重复注册
https://www.nowcoder.com/practice/43acd439112c4b85a9168ad3dd7e2bd1
from operator import ne current_users = ['Niuniu','Niumei','GURR','LOLO'] new_users = ['GurR','Niu Ke Le','LoLo','Tuo Rui Chi'] current_users_t= [] for name in current_users: current_users_t.append(name.lower()) for name in new_users: if name.lower() in current_users_t: print(f"The user name {name} has already been registered! Please change it and try again!") else: print(f"Congratulations, the user name {name} is available!")
将两个列表内的名字都转成小写再比较