题解 | #配置文件恢复#

配置文件恢复

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

代码如其人,谁有我实诚(忘记字典的一个命令,淦!)

while True:
    try:
        cmd = input().split(' ')
        if len(cmd) == 1:
            if cmd[0] in 'reset':
                print('reset what')
            else:
                print('unknown command')
        elif len(cmd) == 2:
            if cmd[0] in 'reset' and cmd[0] in 'reboot':
                print('unknown command')
            elif cmd[0] in 'reset' and cmd[0] not in 'reboot':
                if cmd[1] in 'board' and cmd[1] in 'board':
                    print('board fault')
                else:
                    print('unknown command')
            elif cmd[0] in 'board' and cmd[0] in 'backplane':
                print('unknown command')
            elif cmd[0] in 'board' and cmd[0] not in 'backplane':
                if cmd[1] in 'add':
                    print('where to add')
                elif cmd[1] in 'delete':
                    print('no board at all')
                else:
                    print('unknown command')
            elif cmd[0] in 'reboot' and cmd[0] not in 'reset':
                if cmd[1] in 'backplane':
                    print('impossible')
                else:
                    print('unknown command')
            elif cmd[0] in 'backplane' and cmd[0] not in 'board':
                if cmd[1] in 'abort':
                    print('install first')
                else:
                    print('unknown command')
            else:
                print('unknown command')
        else:
            print('unknown command')
    except:
        break
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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