O'Reilly logo

Hello World! Computer Programming for Kids and Other Beginners by Carter Sande, Warren Sande

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 21. Print Formatting and Strings

Waaaayyyy back in chapter 1, you learned about the print statement. It was the first command we ever used in Python. We’ve also seen (in chapter 5) that you can put a comma at the end of a print statement to make Python keep printing the next thing on the same line. We used that to make prompts for raw_input(), until we learned the shortcut of putting the prompt right in the raw_input() function.

In this chapter, we’re going to look at print formatting—ways to make your program’s output look the way you want it to. We’ll look at things like

  • starting new lines (and when you should do that).
  • spacing things out horizontally (and lining things up in columns).
  • printing variables in the middle of a string. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required