ubuiltins.round: Fix example.

The example did not have proper line breaks between statements.

Also add an additional example using f-strings.
This commit is contained in:
David Lechner
2022-12-28 14:09:18 -06:00
parent 36ee3bd9ef
commit 236bda5f31
+3 -2
View File
@@ -1074,8 +1074,9 @@ def round(*args):
truncate trailing zeros. To print numbers nicely, format strings instead:: truncate trailing zeros. To print numbers nicely, format strings instead::
# print two decimal places # print two decimal places
print('my number: %.2f' % number) print('my number: print('my number: %.2f' % number)
{:.2f}'.format(number)) print('my number: {:.2f}'.format(number))
print(f'my number: {number:.2f}')
Arguments: Arguments:
number (float): The number to be rounded. number (float): The number to be rounded.