I was doing a Hackerrank python problem the task was to print 123...N
(where N
is the input)
without using any string function.
Someone commented a solution which is:
print(*range(1, int(input())+1), sep='')
My question is:
- What is the use of * here with this range() function?
- Why we can't do it by only using range() function inside the print?
- Is there any other way to do this?