πŸ“Š Python
Q. What is the output of the following code?
Code:
l = ['ab', 'cd']
for i in l:
    i.upper()
print(l)
  • (A) [‘AB’, ‘CD’]
  • (B) [‘ab’, ‘cd’]
  • (C) [None, None]
  • (D) None of the above
πŸ’¬ Discuss
βœ… 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.

Explanation by: Tanmay
The upper() function does not modify the string. In this case, it returns a new string but we haven’t stored any.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
196
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Tanmay
Publisher
πŸ“ˆ
95%
Success Rate