def line_break(N, C):
s = [i for i in range(1, (N+1))]
y = 0
while y <= len(s):
print(*s[0:C], end="\n")
y += 1
del s[0:C]
def line_break(limit, step):
def get_chars():
for i in range(1, (limit+1)):
yield f'{i} ' if i % step != 0 else f'{i}\n'
return ''.join(get_chars()).strip()
print(line_break(14, 4))
1 2 3 4
5 6 7 8
9 10 11 12
13 14
print(line_break(25, 5))
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25