Lowes conversion rate between two arbitrary units-python

""
Household projects often require converting between different units. For example, tiles may be measured square inches while your bathroom may be measured in square footage. Suppose you are given a set of conversion rates between different units as a dictionary of dictionaries:

conversions = {
'mile': {'foot': 5280, 'kilometer': 1.60934},
'foot': {'inch': 12},
'kilometer': {'meter': 1000},
'meter': {'centimeter': 100},
}

Given this data structure, write a function that returns the conversion rate between two arbitrary units. E.g., conversion('inch', 'centimeter') = 2.54
"""
conversions = {
'mile': {'foot': 5280, 'kilometer': 1.60934},
'foot': {'inch': 12},
'kilometer': {'meter': 1000},
'meter': {'centimeter': 100},
}
def conversion(unit1:str, unit2:str):

Comments (1)