+ 1

Why does these numbers display in one line? How to place them in different lines?

number = int(input()) while number > 0: print (number) number=number-1

11th Mar 2024, 11:00 PM
Mana Zaman
Mana Zaman - avatar
3 odpowiedzi
+ 3
Mana Xaman Your code should print them in different line. Where did you observe the "in one line" situation? If it is the exercise inside a lesson (mostly on the last page), I think it is a bug and I reported it days earlier.
12th Mar 2024, 4:20 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 4
Hi, Mana Xaman ! print() makes a new line every time you run it, so all your numbers will come at different lines, like this: >>> 4 4 3 2 1
12th Mar 2024, 12:20 AM
Per Bratthammar
Per Bratthammar - avatar
0
Mana Xaman , Check out the end parameter. https://docs.python.org/3/library/functions.html#print
13th Mar 2024, 9:06 AM
Rain
Rain - avatar