每日练习①: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')

 

posted @ 2018-07-19 15:25  q1ang  阅读(397)  评论(0编辑  收藏  举报