nerdexam
Python_Institute

PCAP-31-03 · Question #16

Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? string = 'python' [::2] string = string[-1] + string[-2]

The correct answer is D. string[0] == 'o'. See the full explanation below for the reasoning.

Question

Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? string = 'python' [::2] string = string[-1] + string[-2]

Options

  • Astring[0] == string[-1]
  • Bstring is None
  • Clen (string] == 3
  • Dstring[0] == 'o'

How the community answered

(59 responses)
  • A
    5% (3)
  • B
    17% (10)
  • C
    5% (3)
  • D
    73% (43)

Community Discussion

No community discussion yet for this question.

Full PCAP-31-03 Practice