#Python Currency Exchange exercise : test case fails for Calculate value after

9 messages · Page 1 of 1 (latest)

summer sageBOT
#

How you ask questions makes a huge difference in the help we can provide. Learn how to write good support requests in this article: http://bit.ly/howto-ask

open wigeon
#

Can you share what you need help with? Please do not use images to share text.

heavy hemlock
#

Did you think about reusing any of the existing functions?

open wigeon
#

@vivid depot

vivid depot
#

Python Currency Exchange exercise : test case fails for Calculate value after function

#

Python Currency Exchange exercise : test case fails for Calculate value after

#

@open wigeon
def exchangeable_value(budget, exchange_rate, spread, denomination):
"""

:param budget: float - the amount of your money you are planning to exchange.
:param exchange_rate: float - the unit value of the foreign currency.
:param spread: int - percentage that is taken as an exchange fee.
:param denomination: int - the value of a single bill.
:return: int - maximum value you can get.
"""
spread_value = spread / 100
effective_rate = exchange_rate * (1 - spread_value)
exchanged_amount = budget * effective_rate
max_value = (exchanged_amount // denomination) * denomination
return int(max_value)
#

this is the function but not working

#

i'm getting failed test cases