题解 | #配置文件恢复#

配置文件恢复

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

#新知识:用input().strip().split()去替代[x for x in input().split()]
#我的方法属于逻辑非常简单钻漏洞的方法,正确且思考周全的做法应该是别人的切片法
#但是我懒得改了哈哈哈哈
while True:
    try:        
        list1=input().strip().split()
        if len(list1)==1:
            if list1[0] in 'reset':
                print('reset what',end='\n')
            else:
                print("unknown command",end='\n')
        if len(list1)==2:
            if list1[0] in 'reset' and list1[0] in 'reboot' and list1[1] in 'board'and list1[1] in 'backplane':
                print('unknown command',end='\n')
            elif list1[0] in 'board' and list1[0] in 'backplane' and list1[1] in 'add'and list1[1] in 'abort':
                print('unknown command',end='\n')
            elif list1[0] in 'reset' and list1[1] in 'board':
                print('board fault',end='\n')
            elif list1[0] in 'board' and list1[1] in 'add':
                print("where to add",end='\n')
            elif list1[0] in 'board' and list1[1] in 'delete':
                print("no board at all",end='\n')
            elif list1[0] in 'reboot' and list1[1] in 'backplane':
                print("impossible",end='\n')
            elif list1[0] in 'backplane' and list1[1] in 'abort':
                print("install first",end='\n')
            else:
                print("unknown command",end='\n')
    except:
        break

全部评论

相关推荐

点赞 评论 收藏
分享
半解316:内容充实,细节需要修改一下。 1,整体压缩为一页。所有内容顶格。 2,项目描述删除,直接写个人工作量 修改完之后还需要建议,可以私聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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