Given a list of tuples of known exchange rates and a list of desired currencies to exchange, how would you return the list of converted currencies?
Implement convert_currencies(exchange_rates, requests). Each rate is [source, target, multiplier], and each request is [amount, source, target]. Treat rates as directed edges, and assume every requested conversion has a path. Return converted amounts in request order.
Example: [["USD", "EUR", 0.9]], [[100, "USD", "EUR"]] returns [90.0]. A multi-step path such as USD to EUR to GBP multiplies the rates along the path.
Constraints: Up to 1,000 rates and requests; currency codes are non-empty strings; amounts and rates are positive numbers.
def convert_currencies(exchange_rates, requests):