# Very simple Python question

This topic is 4304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, Sorry for wasting your time but I'm just curious...
counter = 0
while counter <= 10
print counter
counter += 1

Why is each number printed on a new line?! I haven't specified anything to actually do it. Cause you see, when I was initially writing this, I actually tried to implent it. Before that, though, I simply tested if all the code was working properly. Not only was it working properly, but all the numbers were printed on a new line. Is it built-in or something? Then how do I print all the numbers on the same line? Thanks!

##### Share on other sites
http://docs.python.org/ref/print.html
Quote:
 A "\n" character is written at the end, unless the print statement ends with a comma. This is the only action if the statement contains just the keyword print.

##### Share on other sites
Aye, it's built-in. Sorry, didn't know that. Are all prints like that? Is the PHP one like that, too? Anyways, sorry for being so stupid.

##### Share on other sites
Quote:
 Original post by HufferAye, it's built-in. Sorry, didn't know that. Are all prints like that? Is the PHP one like that, too? Anyways, sorry for being so stupid.

Not stupid. You just didn't know.

Python is python and perl is perl. Any simularities are only circumstantial.