2.1. Introduction

This chapter introduces several basic building blocks of Python programs:

These are the basic building blocks that are assembled to create programs that you interact with everyday—from the software running on your smartwatch, to the infrastructure behind the largest websites, and every app running on your phone.

2.1.1. Learning Goals

  • To understand Python’s storage model

  • To understand how to assign values to variables so they can be stored and reused

  • To understand operator precedence

  • To distinguish between expressions, values, and printed representations

  • To recognize & explain hard coding

  • To understand how to get input from an end user

2.1.2. Objectives

After completing the exercises in this chapter, you should be able to:

  • Given some sample code, identify variables that reference an object of a particular type

  • Given a variable of one type, convert it to another

  • Simulate evaluation of an expression and assignment statement

  • Use reassignment to increment a variable

  • Get input from a user and convert the input to the appropriate type

  • Identify the following types of values: strings, integers, floats, functions

  • Recognize valid vs. invalid variable names

  • Write an assignment statement

  • Update a reference diagram after reassignment

You have attempted of activities on this page