I'm trying to divide a dictionary by another dictionary and I cannot find a solution online that works.
Code:
def getRatio(price_a, price_b):
""" Get ratio of price_a and price_b """
""" ------------- Update this function ------------- """
""" Also create some unit tests for this function in client_test.py """
if (price_b == 0):
# avoid zero division error
return
return price_a / price_b
Output:
line 51, in getRatio
return price_a / price_b
TypeError: unsupported operand type(s) for /: 'dict' and 'dict'