Chapter 01: Lecture Notes

Lecture Notes: Chapter 01

Major topics:

Python/IDLE

For now, we will just "play" interactively with the Python Interpreter (essentially as a "glorified desk calculator").

LIVE DEMO

In Chapter 2, we will start to separately create/save/execute Python scripts and IDLE will be even more useful then.

Names/Identifiers and the Python Workspace

Even in interactive mode, Python is already better than many calculators because we can assign names to values, and then use those names in other expressions.

Key issues with assignment statements. A name is assigned a value based on the time the assignment statement is executed, and that remains until that same name is reassigned.  

x = 5
y = 2 + x
x = 10

Key issue is that the third assignment does change the value of x to 10 (rather than previous value of 5)

However, the final statement has no affect on y.  The name y was assigned the value 7 from the second statement and a later change to x doesn't change the value of 7 in the workspace.

Data Types, Operators, Precedence

This chapter provides (mind-numbing?) details about data types, literals, operators, and precedence.  Try not to feel overwhelmed and don't think that you need to immediately memorize all those details. We will also visit some of the more advanced data types (bool, list, tuple) in later chapters.

FOCUS ON THE BIG IDEAS (and can always go back to reference details when needed)

With that said, what exactly is the value of 8 / 2*(2+2) ???


Michael Goldwasser
Last modified: Saturday, 21 December 2019