content: str with open("inflation.txt") as f: content = f.read() def get_inflation_data() -> dict[str: float]: inflation_data: dict[str: float] = {} for line in content.splitlines(): year, value, _ = line.split(" ") value = value[:-1] inflation_data.update({year: float(value) / 100}) return inflation_data