Python Value Assignment Operators

Python Value Assignment Operators

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

OperatorShort WayNormal Way
=my_var = 5my_var = 5
+=my_var +=3my_var = my_var + 3
-=my_var -=3my_var = my_var – 3
*=my_var *=3my_var = my_var * 3
/=my_var /=3my_var = my_var / 3
%=my_var %=3my_var = my_var % 3
**=my_var **=3my_var = my_var ** 3

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply