Operators Flashcards
Python Operator: +
Addition
Definition: Adds two operands. Example: a + b
Python Operator: -
Subtraction
Definition: Subtracts the second operand from the first. Example: a - b
Python Operator: *
Multiplication
Definition: Multiplies two operands. Example: a * b
Python Operator: /
Division
Definition: Divides the first operand by the second. Example: a / b
Python Operator: %
Modulus
Definition: Returns the remainder of division. Example: a % b
Python Operator: **
Exponentiation
Definition: Raises the first operand to the power of the second. Example: a ** b
Python Operator: //
Floor Division
Definition: Divides and returns the largest possible integer. Example: a // b
Python Operator: ==
Equal
Definition: Checks if two operands are equal. Example: a == b
Python Operator: !=
Not Equal
Definition: Checks if two operands are not equal. Example: a != b
Python Operator: >
Greater Than
Definition: Checks if the left operand is greater than the right. Example: a > b
Python Operator: <
Less Than
Definition: Checks if the left operand is less than the right. Example: a < b
Python Operator: >=
Greater Than or Equal To
Definition: Checks if the left operand is greater than or equal to the right. Example: a >= b
Python Operator: <=
Less Than or Equal To
Definition: Checks if the left operand is less than or equal to the right. Example: a <= b
Python Operator: and
And
Definition: True if both operands are true. Example: a and b
Python Operator: or
Or
Definition: True if at least one operand is true. Example: a or b
Python Operator: not
Not
Definition: Inverts the truth value of the operand. Example: not a
Python Operator: =
Assign
Definition: Assigns a value to a variable. Example: a = b
Python Operator: +=
Add and Assign
Definition: Adds and assigns a value. Example: a += b
Python Operator: -=
Subtract and Assign
Definition: Subtracts and assigns a value. Example: a -= b
Python Operator: *=
Multiply and Assign
Definition: Multiplies and assigns a value. Example: a *= b
Python Operator: /=
Divide and Assign
Definition: Divides and assigns a value. Example: a /= b
Python Operator: %=
Modulus and Assign
Definition: Modulus and assigns a value. Example: a %= b
Python Operator: **=
Exponentiation and Assign
Definition: Exponentiation and assigns a value. Example: a **= b
Python Operator: //=
Floor Division and Assign
Definition: Floor division and assigns a value. Example: a //= b