Printing strings

>>> print """In 2009,
... The monetary component of the Nobel Prize
... was US $1.4 million."""
In 2009,
The monetary component of the Nobel Prize
was US $1.4 million.

Types

>>> type("Hello")
<type 'str'>

Booleans

There are two booleans, True and False.

Use booleans to make decisions.

Containment with 'in' and 'not in'

>>> "H" in "Hello"
True
>>> "a" not in ["a", "b", "c"]
False

Equality

== tests for equality

!= tests for inequality

<, <=, >, and >= have the same meaning as in math class.

>>> 0 == 0
True
>>> 0 == 1
False

"a" != "a"

"a" != "A"

Use with if/else blocks

When Python encounters the if keyword, it evaluates the expression following the keyword and before the colon. If that expression is True, Python executes the code in the indented code block under the if line. If that expression is False, Python skips over the code block.