Python_Institute
PCEP-30-02 · Question #384
What is the expected output of the following code? ``python def runner(brand, model="", year=2021, convertible=False): return (brand, str(year), str(convertible)) print(runner("Fermi")[2]) ``
The correct answer is D. ('Fermi', '2021', 'False'). See the full explanation below for the reasoning.
Question
What is the expected output of the following code?
def runner(brand, model="", year=2021, convertible=False):
return (brand, str(year), str(convertible))
print(runner("Fermi")[2])
Options
- A1
- BThe code raises an unhandled exception.
- CFalse
- D('Fermi', '2021', 'False')
How the community answered
(45 responses)- A4% (2)
- B13% (6)
- C7% (3)
- D76% (34)
Community Discussion
No community discussion yet for this question.