题解 | #配置文件恢复#

配置文件恢复

http://www.nowcoder.com/practice/ca6ac6ef9538419abf6f883f7d6f6ee5

while True:
    try:
        s = input().split()
        key = ['reset board', 'board add', 'board delete', 'reboot backplane', 'backplane abort']
        value = ['board fault', 'where to add', 'no board at all', 'impossible', 'install first']
        if len(s) == 1 and s[0] in 'reset':
            print('reset what')
        elif len(s) == 2:
            count = 0
            for i in range(len(key)):
                if s[0] in key[i].split()[0] and s[1] in key[i].split()[1]:
                    count += 1
                    index = i
            if count == 1:
                print(value[index])
            else:
                print('unknown command')
    except:
        break

全部评论
bo a会有两组:board add、reboot backplane
点赞 回复 分享
发布于 2021-10-31 23:25

相关推荐

鼠鼠第一次实习,啥也不懂一直是自己一个人吃的饭,不会做工作老是被嫌弃,大人的世界是这样的吗?
我是星星我会发亮:好的mt有两种,一种愿意教你的,一种几乎什么活都不给你派让你很闲允许你做自己事情的
实习吐槽大会
点赞 评论 收藏
分享
06-23 11:28
门头沟学院 Java
牛客91966197...:也有可能是点拒绝的时候自动弹的话术
点赞 评论 收藏
分享
06-27 15:29
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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