Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def formatLines(lst):
- result = lst[0]
- count = 0
- for item in lst:
- count = count + 1
- if count == 5:
- count = 0
- result = result + "\n" + item
- else:
- result = result + " "
- result = result + item
- return result
- output:
- words_3.txt
- body body cold ence four
- from into just late less
- life live man
- more more
- more more more pain pain
- part race rest rest some
- some sons take take than
- than than that that they
- this this when with with
- with with
- expected output:
- words_3.txt
- age all and and and
- and and and and and
- but but can dav eit
- end ers for for fre
- gen has has his his
- man men not off old
- one sex six six the
- the the the the the
- the the the the the
- the the
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement