DEV Community

Discussion on: Daily Challenge #44 - Mexican Wave

Collapse
 
hectorpascual profile image

My python sol :

def wave(s):
    wave_list = []
    for i,c in enumerate(s):
        wave_list.append(s[:i]+c.upper()+s[i+1:])
    return wave_list

In one line with a generator and a lambda function :

wave = lambda s : [f'{s[:i]}{c.upper()}{s[i+1:]}' for i,c in enumerate(s)]
Collapse
 
jeddevs profile image
Theo

Love it