What is the output of print(f'{3.14159:.2f}') in Python?
print(f'{3.14159:.2f}')
Correct answer
D. 3.14
D. 3.14
The format spec .2f rounds to two decimal places.
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.