1.异常处理 l = ['apple','admin','kobe'] for id,item in enumerate(l,1): print(id,item) try: choose_id = int(input('请输入序号:')) print(l[choose_id-1]) except (ValueError,IndexError): print('请输入正确有效的序号') except Exception as e: print(e) finally: print('当return遇…