Page 149 - Beginning Programming with Pyth - John Paul Mueller
P. 149
*=
/=
%=
**=
//=
Multiplies the value found in the right operand by the value found in the left operand and places the result in the left operand.
Divides the value found in the left operand by the value found in the right operand and places the result in the left operand.
Divides the value found in the left operand by the value found in the right operand and places the remainder in the left operand.
Determines the exponential value found in the left operand when raised to the power of the value found in the right operand and places the result in the left operand.
Divides the value found in the left operand by the value found in the right operand and places the integer (whole number) result in the left operand.
containing 3
MyVar *= 2 results in MyVar containing 10
MyVar /= 2 results in MyVar containing 2.5
MyVar %= 2 results in MyVar containing 1
MyVar **= 2 results in MyVar containing 25
MyVar //= 2 results in MyVar containing 2
Membership
The membership operators detect the appearance of a value within a list or sequence and then output the truth value of that appearance. Think of the membership operators as you would a search routine for a database. You enter a value that you think should appear in the database, and the search routine finds it for you or reports that the value doesn't exist in the database. Table 7-7 describes the membership operators.
TABLE 7-7 Python Membership Operators
Operator Description Example