hacker rank python(text wrap)

TEXT WRAP


def wrap(string, max_width):
  return "\n".join([string[i:i+max_width] for i in range(0, len(string), max_width)])

Compiler Message
Success
Input (stdin)Download
ABCDEFGHIJKLIMNOQRSTUVWXYZ
4
Expected OutputDownload
ABCD
EFGH
IJKL
IMNO
QRST
UVWX
YZ

Comments

Popular posts from this blog

Amazon Web Services

Hacker Rank all java and python problem solutions

Testing tools for React Apps