So I'm currently solving a problem. The instructions are:
accum("abcd") -> "A-Bb-Ccc-Dddd"
accum("RqaEzty") -> "R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy"
accum("cwAt") -> "C-Ww-Aaa-Tttt"
I've written the following program:
def accum(s):
dope = []
i = 0
while i < len(s):
dope.append(list(s)[i].upper())
dope.append(list(s)[i].lower() * i)
i += 1
dope.pop(1)
return dope
But it returns ['A', 'B', 'b', 'C', 'cc', 'D', 'ddd']
instead
So is it another method I should use instead of .append
or how do I combine the upper case letters with the lower case ones?