Certified Associate in Python Programming (PCAP-31-03) — Question 111

Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Choose two.)

string = 'REPTILE'[:3:]
string = string[-1] + string[-2::-1]

Answer options

Correct answer: A, C

Explanation

The correct answer A is true because the length of 'ETI' is indeed 3. Option C is also correct as 'E' is less than 'T' in ASCII value. Option B is incorrect because string[0] evaluates to 'E', which is not equal to 'E', and option D is false since 'string' holds a value, not None.