Jump to content
  • Advertisement
Sign in to follow this  
Huffer

Very simple Python question

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by Huffer
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.


Not stupid. You just didn't know.

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!