Code

How to update variables in Python

Note the following examples:

x = 6 x = 6 + 1 # x is now assigned to 7
x = 5 x = 6 #x is now assigned to 6 x += 1 #x is now assigned to 7 x -= 1 #x is now assigned back to 6
totalbalance = 100 directdeposit = 50 totalbalance = totalbalance + directdeposit print(totalbalance) #Result is 150.

0

3

Updated 2021-01-20

Tags

Data Science