In this section, we will examine the topic of assigning variables.
In Python, assigning a value to a variable is with the value to be assigned on the right and the variable name on the left.
must be like;
my_var = “myvalue”
value assignment operators
Operator | Short Way | Normal Way |
= | my_var = 5 | my_var = 5 |
+= | my_var +=3 | my_var = my_var + 3 |
-= | my_var -=3 | my_var = my_var – 3 |
*= | my_var *=3 | my_var = my_var * 3 |
/= | my_var /=3 | my_var = my_var / 3 |
%= | my_var %=3 | my_var = my_var % 3 |
**= | my_var **=3 | my_var = my_var ** 3 |