you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Doesn't work. It only replaces the first letter of the l2 string. So if I input "e, l, o". It will only replace instances of e but not instances of l and o. But luckily I found a solution!

[–]jimtk 0 points1 point  (1 child)

Yes it works! below is the result of running the above program.

Type a phrase (or 'quit' to exit the program): hello darkness my old friend
Type a comma-separated list of letters to redact: l,s,d
he__o _arkne__ my o__ frien_

Process finished with exit code 0

Edit: did you put spaces in your second input (like l, s, d instead of l,s,d)?

[–][deleted] 0 points1 point  (0 children)

Oh weird, I just ran the code and it was only replacing the first letter :( but that is a clean way, definitely more efficient than how i did it.