Automation and Artificial Intelligence
A script calculates available ports using a function with a default argument. What does it print? ```python def available(total, reserved=2): return total - reserved print(available(10) * 2) ```
Show the answer
Correct answerA. 16
AWhy this is right: The default reserved value is 2, so the expression evaluates to (10 - 2) * 2.
BWhy not this: The function subtracts reserved from total rather than adding it.
CWhy not this: The function subtracts its default reserved value before returning; it does not return 10.
DWhy not this: The function returns 8, but that return value is multiplied by 2 before printing.
The omitted reserved argument takes its default value of 2, so available(10) returns 8; multiplication then produces 16. A result of 20 would ignore the subtraction performed inside the function.