Q. How can you format a float with two decimals?
Solution:
Both ‘{:.2f}’.format(3.14159) and ‘%.2f’ % 3.14159 output ‘3.14’.
Get Question Bank
Strengthen Your Practice with our comprehensive question bank.
Both ‘{:.2f}’.format(3.14159) and ‘%.2f’ % 3.14159 output ‘3.14’.
Strengthen Your Practice with our comprehensive question bank.