2 Introduction to Python Programming

Objectives

In this chapter, you’ll:

  • Continue using IPython interactive mode to enter code snippets and see their results immediately.

  • Write simple Python statements and scripts.

  • Create variables to store data for later use.

  • Become familiar with built-in data types.

  • Use arithmetic operators and comparison operators, and understand their precedence.

  • Use single-, double- and triple-quoted strings.

  • Use built-in function print to display text.

  • Use built-in function input to prompt the user to enter data at the keyboard and get that data for use in the program.

  • Convert text to integer values with built-in function int.

  • Use comparison operators and the if statement to decide whether to execute a statement or group of statements.

  • Learn about objects and Python’s dynamic typing.

  • Use built-in function type to get an object’s type.