An assignment is when a variable is give (assigned) a value.

The value can be:

  • a simple value such as a number or string
  • the result of a calculation or expression
  • an input by the user

Simple Values

To assign a simple value to a variable you can do:

total_score = 54


persons_name = "Mary"

## Calculation or Expression

Often we want to assign the value as a result of calculation. This calculation can include other variables or values.

total_score = test_1_score + test_2_score

We can use any type of arithmentic:

average_score = total_score / 2