PCEP-30-02 · Question #141
The print() function can output values of:
The correct answer is A. any number of arguments (including zero). Python's print() is a variadic function, meaning it accepts zero or more positional arguments - so calling print() with nothing outputs a blank line, and calling it with many arguments (e.g., print(1, 2, 3, "hello")) prints them all space-separated, making A correct. Option B…
Question
Options
- Aany number of arguments (including zero)
- Bany number of arguments (excluding zero)
- Cnot more than five arguments
- Djust one argument
How the community answered
(18 responses)- A72% (13)
- B17% (3)
- C6% (1)
- D6% (1)
Explanation
Python's print() is a variadic function, meaning it accepts zero or more positional arguments - so calling print() with nothing outputs a blank line, and calling it with many arguments (e.g., print(1, 2, 3, "hello")) prints them all space-separated, making A correct. Option B is wrong because zero arguments is explicitly valid and useful. Option C invents a five-argument cap that doesn't exist in Python. Option D is wrong because print() can handle multiple arguments via the *objects parameter, not just one.
Memory tip: Think of print() as a megaphone you can point at nothing (blank line) or any crowd of values - there's no bouncer at the door limiting how many can enter.
Community Discussion
No community discussion yet for this question.