题解 | #禁止重复注册#

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

全部评论

相关推荐

评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务