Please Login in order to post a comment
import textwrap
def wrap(string, max_width):
return textwrap.fill(string, max_width)
if name == 'main': string, max_width = input(), int(input()) result = wrap(string, max_width) print(result)
Solution rs_str = "" counter = abs(len(string)/max_width)
while counter > -1: rs_str += string[:max_width]+'\n' string = string.removeprefix(string[:max_width]) counter -= 1
return rs_str `
def wrap(string, max_width): return textwrap.fill(string,max_width)
def wrap(string, max_width): i = 0 wrapped = '' while i < len(string): wrapped = wrapped + string[i] i = i + 1 if i % max_width == 0: wrapped = wrapped + '\n' return wrapped
def wrap(string, max_width): count = 0 y = "" for i in string:
if count == max_width: y = y + "\n" count = 0 y += i count += 1 return y
Seems like cookies are disabled on this browser, please enable them to open this website
import textwrap
def wrap(string, max_width):
if name == 'main': string, max_width = input(), int(input()) result = wrap(string, max_width) print(result)
Solution rs_str = "" counter = abs(len(string)/max_width)
while counter > -1: rs_str += string[:max_width]+'\n' string = string.removeprefix(string[:max_width]) counter -= 1
return rs_str `
def wrap(string, max_width): return textwrap.fill(string,max_width)
def wrap(string, max_width): i = 0 wrapped = '' while i < len(string): wrapped = wrapped + string[i] i = i + 1 if i % max_width == 0: wrapped = wrapped + '\n'
return wrapped
def wrap(string, max_width): count = 0 y = "" for i in string: