Hướng dẫn compound assignment operators python
Ngày đăng:
01/10/2022
Trả lời:
0
Lượt xem:
114
Understanding the += operator with a code - Show
In all the compound assignment operators, the expression on the right side of = is always calculated first and then the compound assignment operator will start its functioning. Hence in the last code, statement i+=2*2; is equal to i=i+(2*2), which results in i=i+4, and finally it returns 6 to i. Example with += operator Output is
Advertisement -= operator
Understanding the -= operator with a code -
Example with -= operator Output is
*= operator
Understanding the *= operator with a code -
Example with *= operator
Output -
/= operator
Understanding the /= operator with a code -
Example with /= operator
Output-
//= operator
Understanding the //= operator with a code -
Example with //= operator
Output-
Please share this article -
Advertisement |