Book Image

Python Essentials

By : Steven F. Lott
Book Image

Python Essentials

By: Steven F. Lott

Overview of this book

Table of Contents (22 chapters)
Python Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 3. Expressions and Output

Expressions are central to Python programming. As noted in Chapter 1, Getting Started, Python has a rich collection of operators and built-in functions. In this chapter, we'll summarize the relationship between data types and the operators they support.

Perhaps the most fundamental program possible is one that performs a calculation and displays output. To demonstrate this, we'll look at the print() function in this chapter. We'll expand on the basics by looking at a number of ways to produce nicely-formatted text output.

We'll need to look in detail at the Python syntax rules. This will be essential for writing scripts with more complex sequences of statements. It will also set the stage for looking at compound statements in Chapter 5, Logic, Comparisons, and Conditions.

This chapter will also demonstrate some additional string processing techniques. We'll summarize some of the standard library modules that are focused on string processing. We'll look closely...