标签:print 排序 lse div [] input def += sort
def q_sort(nums): if not nums: return [] else: div = nums[0] left = q_sort([l for l in nums[1:] if l <= div ]) right = q_sort([r for r in nums[1:] if r > div ]) return left+[div]+right input_01 = input(‘输入排序数列,以 ,分隔:\n‘) nums1 = [] nums1 += [int(i) for i in input_01.split(‘,‘)] nums1_1 = q_sort(nums1) print (nums1_1)
标签:print 排序 lse div [] input def += sort
原文地址:https://www.cnblogs.com/pscc/p/9610854.html