Objective
The textwrap module formats paragraphs: it splits a text into lines of a maximum width and can shorten it by adding an ellipsis.
Instructions
- Read an integer
width(at least 10) and a line of text. - Show the text split into lines of at most
widthcharacters withtextwrap.fill(text, width). - Show a line with three hyphens:
---. - Show the text shortened to
widthcharacters withtextwrap.shorten(text, width, placeholder="...").
20
una frase de ejemplo para ajustar a un ancho fijo
una frase de ejemplo
para ajustar a un
ancho fijo
---
una frase de...
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise