Cropping texts in Python with 'textwrap.shorten'

from blog Redowan's Reflections, | ↗ original
Problem A common interview question that I’ve seen goes as follows: Write a function to crop a text corpus without breaking any word. Take the length of the text up to which character you should trim. Make sure that the cropped text doesn’t have any trailing space. Try to maximize the number of words you can pack in your trimmed text. Your...