题解 | #配置文件恢复#
配置文件恢复
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