Skip to content

Commit

Permalink
ubuiltins.round: Fix example.
Browse files Browse the repository at this point in the history
The example did not have proper line breaks between statements.

Also add an additional example using f-strings.
  • Loading branch information
dlech committed Dec 28, 2022
1 parent 36ee3bd commit 236bda5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ubuiltins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,9 @@ def round(*args):
truncate trailing zeros. To print numbers nicely, format strings instead::
# print two decimal places
print('my number: %.2f' % number) print('my number:
{:.2f}'.format(number))
print('my number: %.2f' % number)
print('my number: {:.2f}'.format(number))
print(f'my number: {number:.2f}')
Arguments:
number (float): The number to be rounded.
Expand Down

0 comments on commit 236bda5

Please sign in to comment.