题解 | #禁止重复注册#
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!')