标签:logs 技术分享 app com 数据 nbsp form .com []
s = ‘2kd4-1124*2|^2sdAmZ%fkMcv‘ def fun(s): li = [] li2 = [] tu = () for i in s: li.append(i) print(‘排序前:‘,end=‘‘) print(li) n = len(li) for i in range(n-1): for j in range(n-1-i): if li[j]<li[j+1]: li[j],li[j+1] = li[j+1],li[j] if n%2==0: for i in range(n//2): li2.append(‘({},{})‘.format(li[i],li[n-1-i])) else: for i in range(n//2): li2.append(‘({},{})‘.format(li[i], li[n-1-i])) li2.append(‘({})‘.format(li[n//2])) print(‘排序后:‘,end=‘‘) print(li) return tuple(li2) tu = fun(s) print(‘新格式:‘,end=‘‘) print(tu)
标签:logs 技术分享 app com 数据 nbsp form .com []
原文地址:http://www.cnblogs.com/UncleYong/p/7103947.html