Recall & Review
beginner
What does the
abs() function do in Python?The
abs() function returns the absolute value of a number, which means it removes any negative sign and gives the distance from zero.Click to reveal answer
beginner
How do you calculate the power of a number in Python?
You can use the
** operator or the pow() function. For example, 2 ** 3 or pow(2, 3) both give 8.Click to reveal answer
intermediate
What is the difference between
// and / operators in Python?/ does normal division and returns a float. // does floor division and returns the largest whole number less than or equal to the result.Click to reveal answer
beginner
How can you get the remainder of a division in Python?
Use the modulo operator
%. For example, 7 % 3 gives 1 because 7 divided by 3 leaves a remainder of 1.Click to reveal answer
beginner
What does the
round() function do?The
round() function rounds a floating-point number to the nearest whole number or to a specified number of decimal places.Click to reveal answer
What is the output of
abs(-10) in Python?✗ Incorrect
abs() returns the positive value of a number, so abs(-10) is 10.Which operator gives the remainder of a division?
✗ Incorrect
The modulo operator
% returns the remainder after division.What does
5 // 2 return?✗ Incorrect
// is floor division, so 5 // 2 returns 2.How do you calculate 3 to the power of 4 in Python?
✗ Incorrect
The power operator is
**, so 3 ** 4 calculates 3 to the power of 4.What does
round(3.14159, 2) return?✗ Incorrect
round() rounds to the specified decimal places, so rounding to 2 decimals gives 3.14.Explain how to perform division and get both the quotient and remainder in Python.
Think about how to get the whole number part and the leftover part separately.
You got /4 concepts.
Describe how to use Python functions and operators to calculate powers and absolute values.
Remember the symbols and function names that help with these math operations.
You got /4 concepts.