How to add new line in python. for example, I would like to print the rest of a sentence in a new line. but instead of putting "\n", I will automate it to type to a new line for every six words.
def wrapper(words, n):
to_print = ''
for i in range(0, len(words.split()), n):
to_print += ' '.join(words.split()[i:i+n]) + '\n' # new line
return to_print
print(wrapper('a b c d e f g h i j k l m n o p r s t u w x y z', 6))
print('any text')
on November 04th, 2018 (11:37 am)
What masters said
You must sign in to comment!!
All comments
This solution has not been commented yet.
Add to cart was successful
Register a person to Idomaster.com
I want to register:
Log in to Idomaster.com
Request a password reset
Log in to Idomaster.com
We use cookies to give you the best possible experience on our site. By continuing to use the site you agree to our use of cookies. Find out moreAccept
Solutions