fork download
  1. def change(word, final):
  2. output = []
  3. [output.append(final[:i] + word[i:]) for i in range(len(final)+1)]
  4. return '\n'.join(word for word in output)
  5.  
  6. challenges = (('floor', 'brake'), ('wood', 'book'), ('a fall to the floor', 'braking the door in'))
  7. [print(change(challenge[0], challenge[1]) + '\n') for challenge in challenges]
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
floor
bloor
broor
braor
brakr
brake

wood
bood
bood
bood
book

a fall to the floor
b fall to the floor
brfall to the floor
braall to the floor
brakll to the floor
brakil to the floor
brakin to the floor
brakingto the floor
braking o the floor
braking t the floor
braking ththe floor
braking thehe floor
braking the e floor
braking the d floor
braking the dofloor
braking the dooloor
braking the dooroor
braking the door or
braking the door ir
braking the door in