Q. What is the output of the following code?
Code:
l = ['ab', 'cd']
for i in l:
i.upper()
print(l)
β
Correct Answer: (B)
[‘ab’, ‘cd’]
Explanation: The upper() function does not modify the string. In this case, it returns a new string but we haven’t stored any.