Why every no. Is displayed in new line | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why every no. Is displayed in new line

All should be together

28th Mar 2020, 10:53 AM
Harshit Gupta
12 Antworten
+ 1
The way you want to print the numbers is of your choice/pattren not according to loop.Loops only itterates the number according to condition. Kindly explain your question what you are exactly asking for?kindly use tags for clear explanation.thanks
28th Mar 2020, 11:07 AM
Muhammad Bilal
Muhammad Bilal - avatar
+ 1
You are asking about which language because in different language print statement are different . Kindly explain about which language you are asking for??
28th Mar 2020, 11:12 AM
Muhammad Bilal
Muhammad Bilal - avatar
+ 1
Harshit Gupta for i in range(3): print(i ,end=" ") Now they are printing on same line with single space Output: 0 1 2
28th Mar 2020, 11:15 AM
Muhammad Bilal
Muhammad Bilal - avatar
+ 1
i = 1 while i <=5: print(i,end=" ") i = i + 1 print("Finished!") Output: 1 2 3 4 5 Finished!
28th Mar 2020, 11:20 AM
Muhammad Bilal
Muhammad Bilal - avatar
0
Since print function is used to print anything in it in one line then why all no. Are in seperate new line
28th Mar 2020, 11:09 AM
Harshit Gupta
28th Mar 2020, 11:12 AM
Harshit Gupta
0
There is question in pythin looping in which print statement is used and in output all no. Get seperate new line but previously when strings were in print function they were in same line in its output
28th Mar 2020, 11:15 AM
Harshit Gupta
0
i = 1 while i <=5: print(i) i = i + 1 print("Finished!") Output: 1 2 3 4 5 Finished
28th Mar 2020, 11:19 AM
Harshit Gupta
0
Why every no. Is in new line Kindly explain
28th Mar 2020, 11:19 AM
Harshit Gupta
0
Ok thanks
28th Mar 2020, 11:22 AM
Harshit Gupta
0
Harshit Gupta A simple explanation of using "end" in print statement The default value of end is \n meaning that after the print statement it will print a new line. So simply stated end is what you want to be printed after the print statement has been executed. Eg: - print ("hello",end=" +") will print hello +.
28th Mar 2020, 11:57 AM
Muhammad Bilal
Muhammad Bilal - avatar
0
Printf("\n\n%d",variablename);
29th Mar 2020, 3:03 PM
T. Siva Kiran
T. Siva Kiran - avatar