There are many answers to today’s exercise on Programming Praxis which is to remove from a string characters given in another string. I liked most the Perl one by Paul G. where he used substitution to get the result in one line.

In python I implemented the obvious list comprehension solution and for comparison the substitution trick. Even counting the import statement the latter approach is a bit shorter (to be fair it has no error checking and can be fooled). That’s thinking out of the box!

See the source here: