Discussion :: Python MCQs
-
What is the output of the following?print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))
Answer : Option A
Explanation :
The function translate expects a dictionary of integers. Use maketrans() instead of doing the above.
Be The First To Comment