每日练习①:accum
题目:
def accum(s): #写你的代码,代码输出结果 #accum("abcd") # "A-Bb-Ccc-Dddd" #accum("cwAt") # "C-Ww-Aaa-Tttt"
代码:
def accum(s): res_list=[] for index,inter in enumerate(s): res_list.append(inter.upper()+inter.lower()*index) print('-'.join(res_list)) accum('abcd') accum('cwAT')