0

Why in the below program the output is not 12345 instead the output is displayed in separate lines?

i = 1 while i <=5: print(i) i = i + 1

24th May 2017, 2:17 PM
kishore kumar
kishore kumar - avatar
2 Réponses
+ 7
In python, The print() includes 'new line'. if you don't want 'new line', rewrite as follows print(i, end='')
24th May 2017, 2:33 PM
Suyasa
Suyasa - avatar
+ 1
As rightly said print() creates a new line and if you want to display the output in the same line just add a comma after the entire print statement.
26th May 2017, 8:15 PM
Abhishek G