0
How to Print the Elements of any list or any loop in same row instead of printing it in different row?
2 Answers
+ 1
The print function has an optional parameter called end which gives you the ability to literally, chose how you want to separate your arguments.
alist = [ 1, 2, 3 ]
for i in alist:
print(i, end=' ')
+ 1
Thanks a lot buddy