Arithmetic Operators
Standard Arithmetic Operators ( + - * / )
Standard arithmetic functions work as normal in Python. Take note that multiplication is achieved using an asterisk * .
a = 5 b = 3 result = a + b
result = a - b print(result) #The output will be 2.
result = a * b print(result) #The output will be 15.
a = 10 b = 2 result = a / b print(result) # The output will be 5.0.
Arithmetic operators are used to perform [[mathematical]] calculations.
{"cloze_text": "Arithmetic operators are used to perform [[mathematical]] calculations."}
The arithmetic operator [[*]] is used to perform multiplication.
{"cloze_text": "The arithmetic operator [[*]] is used to perform multiplication."}
In Python, what is the result of the expression 20 - 10?
{"answers": {"A": "10", "B": "None", "C": "30", "D": "20"}, "question_text": "In Python, what is the result of the expression 20 - 10?", "correct_answer": "A"}
Modulo (%)
The modulo operator is used to find the remainder of a division. For example:
a = 15 b = 4 result = a % b print(result) #The output will be 3.
What is the remainder when 7 is divided by 2?
{"answers": {"A": "3", "B": "2", "C": "1", "D": "0"}, "question_text": "What is the remainder when 7 is divided by 2?", "correct_answer": "C"}
Floor division
Floor division (also known as integer division) is performed using the double forward slash operator //.
It divides one number by another and returns the quotient rounded down to the nearest whole number.
x = 10
y = 3
result = x // y # Floor division of 10 by 3
print(result) # Output: 3
What is the result of 10 // 3?
{"answers": {"A": "3", "B": "2", "C": "3.33", "D": "2.5"}, "question_text": "What is the result of 10 // 3?", "correct_answer": "A"}
Exponentiation (**)
The exponentiation operator is used to raise a number to a power.
Example:
a = 2
b = 3
result = a ** b
print(result) #The output will be 8.
In Python, what is the result of 2 ** 4?
{"answers": {"A": "6", "B": "0.5", "C": "16", "D": "8"}, "question_text": "In Python, what is the result of 2 ** 4?", "correct_answer": "C"}
Review: Fill in the Blanks
In Python, standard arithmetic operators like , , , and work as they normally do. For example, multiplication is performed using an asterisk , which is essential for executing the operation correctly in code.
The operator, represented by the percentage symbol , is used to determine the of a division operation. For instance, if you divide 15 by 4, the result of the modulo operation will yield the value of 3, indicating what remains after the division.
Floor division, also known as , is performed using the double forward slash . This operator divides one number by another and provides the rounded down to the nearest whole number, which is crucial for certain types of calculations.
The exponentiation operator, denoted by , is utilized to raise a number to a specific . For example, if you raise 2 to the power of 3, the result will equal 8, demonstrating how exponentiation works in Python.
The operator, represented by the percentage symbol , is used to determine the of a division operation. For instance, if you divide 15 by 4, the result of the modulo operation will yield the value of 3, indicating what remains after the division.
Floor division, also known as , is performed using the double forward slash . This operator divides one number by another and provides the rounded down to the nearest whole number, which is crucial for certain types of calculations.
The exponentiation operator, denoted by , is utilized to raise a number to a specific . For example, if you raise 2 to the power of 3, the result will equal 8, demonstrating how exponentiation works in Python.
Click the keywords below to fill in the blanks:
//
Modulo
%
Quotient
**
Remainder
*
Power
Integer Division
Addition
Multiplication
Division
Subtraction
â All blanks filled correctly! Great job!
Complete! Ready to test your knowledge?
Arithmetic Operators in Python
- Standard Arithmetic Operators ( + - * / )
- Modulo (%)
- Floor division
- Exponentiation (**)
Topic Tests
Š learnlearn.uk 2025 |
[email protected] |
Privacy Policy.