What is the output of print('ab'.removesuffix('b')) in Python?
print('ab'.removesuffix('b'))
Correct answer
D. a
D. a
removesuffix (3.9+) strips a suffix if present.
Asked in: Python Interview Strings
https://docs.python.org/3/library/stdtypes.html#string-methodsNot sure why the answer is D? Ask here and get an explanation.