题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584
s = input() s = list(s) len_s = len(s) i = 0 while i < len_s: if 'a'<= s[i]<= 'z' or 'A'<= s[i] <= 'Z' : t = i j = i+1 while j < len_s: if 'a'<= s[j]<= 'z' or 'A'<= s[j] <= 'Z' : if s[t].upper() > s[j].upper(): s[t],s[j] = s[j],s[t] t = j j += 1 len_s -= 1 i = -1 i += 1 print(''.join(s))
原始一点点的解法 文章被收录于专栏
尽量不借助面向对象的思想,自己去实习具体过程