0
The code is written to print no.s upto user defined range in a single line without using string. What is the use of " * " ?
print(*range(1, int(input())+1), sep=' ')
2 Réponses
+ 4
If you use print(range(10), sep=', '), it will just print 'range (0, 10)'.
If you use print(*range(10), sep=', '), it will print '0, 1, 2, 3, 4, 5, 6, 7, 8, 9'.
The asterisk evaluates the expression and will print the actual content of the expression rather than the outline.
+ 3
Man lernt nicht aus 🎓