for i inrange(1,100):
print i
And the output is like:
1
2
3
.
.
99
I want it to print in the same line like: 1 2 3 . . . 99
Solution: use ',' to prevent starting from a new line:
for i in range(1,100):
print i,
Another thing is that if you want to start something from a new line, you should use '\n' in either 'print '\n' ' or '.write('\n')'
print i,
No comments:
Post a Comment