First solution in Clear category for Cut Sentence by hillelna
def cut_sentence(line, length):
Cut a given sentence, so it becomes shorter than or equal to a given length.
# case line is shorter
# case length ends on a ' '
if line[length]==' ':
return line[:length] + '...'
# case length shorter than first word
March 11, 2020