human
Remove final characters from string recursively - What's the best way to do this?
assistant
Here is some code to remove letters from string `example_line` if the letter exist in list `bad_chars`

"""""".join(dropwhile(lambda x: x in bad_chars, example_line[::-1]))[::-1]

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.