Explanation: The abs () function returns the absolute value of the passed argument. For example: abs (-5) = 5. Therefore, in this case, abs (5.0) = 5.0.
Question 8: What are the results of the function shown below?
sum(2,4,6) sum([1,2,3])
Error, 6
12, Error
12, 6
Lỗi, Lỗi
Explanation: The first function will have an error because sum () is used to find the sum of iterable numbers. Therefore, the result will be Error and 6 respectively.
Question 9: Output of the following function is:
all(3,0,4.2)
True
False
Lỗi
0
Explanation: The all () function returns True when iterable elements are different from zero. In the above case, the values are not iterable, so an error will occur.
Question 10: What is the result of the following expression?
min(max(False,-3,-4), 2,7)
2
False
-3
-4
Explanation: The max () function is used to find the maximum value in three values -3, -4 and false. 'false' is treated as a value of 0, so the other expression is min (0, 2, 7), so the result will be 0 (false)