A simple Python program

We will now write a program -- a series of instructions that Python will execute sequentially.

In [1]:
exam_grade = 98
engsci_adjustment = 20
exam_grade = exam_grade - engsci_adjustment
print(exam_grade)
78

First we assign 98 to exam_grade and 20 to engsci_adjustment. Then we compute (exam_grade - engsci_adjustment), and assign that to exam_grade. Fianlly, we print exam_grade.

Note the difference from math. The following:

exam_grade = exam_grade - engsci_adjustment

is not an equation (i.e., we can't conclude that engsci_adjustment is 0 or anything like that). Rather, it's an instruction: evaluate (exam_grade - engsci_adjustment), and put whatever value you get into the variable exam_grade, forgetting what exam_grade was before.

The result is that exam_grade becomes 78, and then that value gets printed.