NP24 禁止重复注册
思路:
step1:创建两个列表;
step2:将cur列表转化为小写字母形式;
step3:遍历new_列表,对应要求,分别打印输出;
代码如下:
current_users = ['Niuniu','Niumei','GURR','LOLO']
new_users = ['GurR','Niu Ke Le','LoLo','Tuo Rui Chi']
current_users_L = [i.lower() for i in current_users]
for i in new_users:
if i.lower() in current_users_L:
print('The user name {} has already been registered! Please change it and try again!'.format(i))
else:
print('Congratulations, the user name {} is available!'.format(i))

京公网安备 11010502036488号