1 def fun(arg): 2 try: 3 li = list(arg) 4 if(sorted(li)==li): 5 print('顺序序列UP') 6 elif(sorted(li, reverse=True)==li): 7 print('逆序序列DOWN') 8 else: 9 print('None') 10 except Exception as e: 11 print('您输入的不是序列,请输入一个序列') 12
1 def fun(arg): 2 try: 3 li = list(arg) 4 if(sorted(li)==li): 5 print('顺序序列UP') 6 elif(sorted(li, reverse=True)==li): 7 print('逆序序列DOWN') 8 else: 9 print('None') 10 except Exception as e: 11 print('您输入的不是序列,请输入一个序列') 12