Exam PCAP-31-03 All QuestionsBrowse all questions from this exam
Question 63

What is the expected output of the following code?

mytu = ('a', 'b', 'c')

m = tuple(map(lambda x: chr(ord(x) + 1), mytu))

print(m[-2])

    Correct Answer: D

    The code snippet converts each character in the tuple 'mytu' ('a', 'b', 'c') to the next character in the ASCII sequence using a lambda function inside the map function. The characters 'a', 'b', and 'c' will be converted to 'b', 'c', and 'd' respectively. When the result is converted back to a tuple and stored in 'm', it becomes ('b', 'c', 'd'). Accessing the second last element, m[-2], will give 'c'.

Discussion
kstrOption: D

D right answer

DKAT2023Option: D

D is the correct