Expressions

Expressions are also instructions to Python to perform a task. That task is to return a value, such as the result of a mathematical operation or the truth or falsity of a statement. Expressions can be assigned variables. Also, many of them use operators, which can be words like and, or, and not, or symbols such as + (plus), - (minus), * (multiplication), and = (equals). We'll cover operators in detail in Chapter 3. For now, just remember that expressions return a value and usually use operators.

For Novices: Expressions in Spreadsheets

If you've ever used spreadsheets, you've used expressions and operators. An expression is equivalent to a spreadsheet formula.

Let's say that, in cell D1 of a spreadsheet, you have the formula =(A1*B1)/C1 ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.