You are viewing a single comment's thread. Return to all comments →
Without Using textwrap module
import textwrap def wrap(string, max_width): string_list= [] i = 0 while(i<= len(string)): string_sliced = string[i: i+max_width] string_list.append(string_sliced) i = i + max_width for item in string_list: print(item) return "" if __name__ == '__main__': string, max_width = input(), int(input()) result = wrap(string, max_width) print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
Text Wrap
You are viewing a single comment's thread. Return to all comments →
Without Using textwrap module