Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96ce732

Browse files
committed
refactor: rounded off the converted value by 2 decimal places
Signed-off-by: supr1yo <[email protected]>
1 parent bec9f88 commit 96ce732

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CurrencyConverter/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def convert_currency_with_api(amount, from_currency, to_currency, api_key):
2323
if exchange_rate is not None:
2424
converted_amount = amount * exchange_rate
2525
result = (
26-
f"{amount} {from_currency} is equal to {converted_amount} {to_currency}"
26+
f"{amount} {from_currency} is equal to {round(converted_amount, 2)} {to_currency}"
2727
)
2828
return result
2929
else:

0 commit comments

Comments
 (0)