Certified Entry-Level Python Programmer (PCEP-30-02) — Question 53

What is the expected output of the following code?
print(chr(ord('z') - 2))

Answer options

Correct answer: A

Explanation

The code first gets the ASCII value of 'z', which is 122, then subtracts 2, resulting in 120. The character corresponding to ASCII value 120 is 'x', making option A the correct answer. The other options do not correspond to the computed ASCII value.