Using %-formatting, I can specify the number of decimal cases in a string:
x = 3.14159265
print('pi = %0.2f' %x)
This would give me:
pi = 3.14
Is there any way of doing this using f-strings in Python 3.6?
Using %-formatting, I can specify the number of decimal cases in a string:
x = 3.14159265
print('pi = %0.2f' %x)
This would give me:
pi = 3.14
Is there any way of doing this using f-strings in Python 3.6?