题解 | 禁止重复注册

禁止重复注册

https://www.nowcoder.com/practice/43acd439112c4b85a9168ad3dd7e2bd1

import sys

c_users = ['Niuniu','Niumei','GURR','LOLO']
n_users = ['GurR','Niu Ke Le','LoLo','Tuo Rui Chi']

is_same = 0
for i in n_users:
    for j in c_users:
        if(i.upper() == j.upper()):
            print(f'The user name {i} has already been registered! Please change it and try again!')
            is_same = 1
            break
    if(is_same == 1):
        is_same = 0
    else:
        print(f'Congratulations, the user name {i} is available!')

#使用break 和标志is_same

        
        

全部评论

相关推荐

11-06 16:50
门头沟学院 Java
用微笑面对困难:word打字比赛二等奖的我,也要来凑合凑合
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务