Implement a function that, given a feedback
and the size of the screen, splits the feedback
into lines so that:
I have to complete this function by filling up the ... spaces.
For
and the size of the screen, splits the feedback
into lines so that:
- each token (i.e. sequence of non-whitespace characters) belongs to one of the lines entirely;
- each line is at most size characters long;
- no line has trailing or leading spaces;
- each line should have the maximum possible length, assuming that all lines before it were also the longest possible length.
I have to complete this function by filling up the ... spaces.
import ... def feedbackReview(feedback, size): return ...Examples:
For
feedback = "This is an example feedback"and
size = 8the output should be
feedbackReview(feedback, size) = ["This is", "an", "example", "feedback"]Thank you.