#!/usr/bin/env python3 """Mission 3 — 가상 예산 API 스텁. PTC 실습: 50명 일괄 조회는 루프 한 번으로 처리.""" from __future__ import annotations # 직원 id 1..50: (이름, 지출, 한도) _STAFF: list[tuple[str, float, float]] = [ (f"emp_{i:02d}", float(800 + (i * 13) % 400), 1000.0 + (i % 5) * 50) for i in range(1, 51) ] def employee_record(employee_id: int) -> dict[str, float | str | bool]: if not 1 <= employee_id <= len(_STAFF): raise ValueError("employee_id out of range") name, spent, limit = _STAFF[employee_id - 1] over = spent > limit return { "id": employee_id, "name": name, "spent": spent, "limit": limit, "over_budget": over, } def all_summaries() -> list[dict[str, float | str | bool]]: return [employee_record(i) for i in range(1, 51)] if __name__ == "__main__": import json print(json.dumps(all_summaries(), indent=2))