A
Albert Hopkins
Then why not define end='' instead?
I think the OP meant that ' ' is wanted up until the final item.. so
something like
for i in range(4):
print(i, end=' ')
print(4)
or, better:
print(' '.join(str(i) for i in range(5)))