nerdexam
Python_Institute

PCEP-30-02 · Question #333

Consider the following code. x = 42 y = 7 data = "I'm gonna make him an offer he can't refuse." Which of the following expressions will evaluate to 19?

The correct answer is C. data.find('an') if data else None. See the full explanation below for the reasoning.

Question

Consider the following code. x = 42 y = 7 data = "I'm gonna make him an offer he can't refuse." Which of the following expressions will evaluate to 19?

Options

  • Adata.rfind('an') if data else None
  • B19 if how else y
  • Cdata.find('an') if data else None
  • D7 if len(data) > 19 else 6

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    80% (20)
  • D
    12% (3)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice