nerdexam
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)
  • A
    4% (2)
  • B
    13% (6)
  • C
    7% (3)
  • D
    76% (34)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice