Exercise 93
Write a Python program which wrap a given string into a paragraph of given width Solution
import textwrap
def wrapText(s , w):
return textwrap.fill(s,w)
# Example
s = "Python is open source programming language"
print(wrapText(s , 20))
"""
The out put is:
Python is open
source programming
language
"""
Younes Derfoufi
my-courses.net
my-courses.net