This function returns a tuple of gas stations. Args: gas_quantities: Amount of gas available at each station costs: The cost of gas required to move from one station to the next Returns: A tuple of gas stations >>> gas_stations = get_gas_stations([1, 2, 3,
(
gas_quantities: list[int], costs: list[int]
)
| 34 | |
| 35 | |
| 36 | def get_gas_stations( |
| 37 | gas_quantities: list[int], costs: list[int] |
| 38 | ) -> tuple[GasStation, ...]: |
| 39 | """ |
| 40 | This function returns a tuple of gas stations. |
| 41 | |
| 42 | Args: |
| 43 | gas_quantities: Amount of gas available at each station |
| 44 | costs: The cost of gas required to move from one station to the next |
| 45 | |
| 46 | Returns: |
| 47 | A tuple of gas stations |
| 48 | |
| 49 | >>> gas_stations = get_gas_stations([1, 2, 3, 4, 5], [3, 4, 5, 1, 2]) |
| 50 | >>> len(gas_stations) |
| 51 | 5 |
| 52 | >>> gas_stations[0] |
| 53 | GasStation(gas_quantity=1, cost=3) |
| 54 | >>> gas_stations[-1] |
| 55 | GasStation(gas_quantity=5, cost=2) |
| 56 | """ |
| 57 | return tuple( |
| 58 | GasStation(quantity, cost) for quantity, cost in zip(gas_quantities, costs) |
| 59 | ) |
| 60 | |
| 61 | |
| 62 | def can_complete_journey(gas_stations: tuple[GasStation, ...]) -> int: |