Refactor LMPTHW Exercise 8

@zedshaw Hi, I am working on the cut exercise in LMPTHW and I’ve come this far:

Please what do you suggest for refactoring my solution. I was thinking about using regexps to more accurately match the field arguments. And the cut_text function is quite long.

Thank you for your help.

I’d say that’s pretty good so far. I can’t see how I’d refactor it in any meaningful way. Maybe try writing an automated test for it instead.

Thank you.

I don’t know how to write automated tests yet.

It’s not too hard, but it does force you to write code about code, so wait until later in the book and you’ll do a lot of it.