Modifying Variables

The only way to change a value in python is via the assignment operator (=). So if we want to change the value stored in one, say by adding 4, we have to get a little creative.

Let’s say you have a variable named shmoo, if you wanted to change that number by four, you would do so like so on the right:

shmoo = 6
shmoo = shmoo + 4

Now when you print the variable “shmoo”, it will print out the number 10. Python also supports subtraction(-), multiplication(*), and division, as well as some more fancy ones that you can read about here. Give this a try in your code editor!