Solution: How to add new line in code in python console

Development | Programming languages
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)
All coments
This solution has not been commented yet.
You must sign in to comment!! LOGIN
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 more Accept