Issue
What does the operator /=
(slash equals) mean in Python?
I know |=
is a set operator. I have not seen /=
previously though.
Solution
It's an assignment operator shorthand for /
and =
.
Example:
x = 12
x /= 3
# equivalent to
x = x / 3
If you use help('/=')
, you can get the full amount of symbols supported by this style of syntax (including but not limited to +=
, -=
, and *=
), which I would strongly encourage.
Answered By - Makoto Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.