一些python算法题
程序员文章站
2022-03-08 14:40:52
...
# 今日头条测试开发面试编程题:123456789隔三个字符反转成321654987
def reverse_by_3(s):
s1 = ''
while True:
first = s[:3]
s1 += first[::-1]
s = s[3:]
if len(s)<3:
s1 += s
break
return s1