Q. What is the output of the following code?
Code:
x = 'abcd' print(x[::-1])
β
Correct Answer: (B)
dcba
Explanation: The slice [::-1] reverses a string.