🛠️ToolsShed

투자 회수 기간 계산기

연간 현금 유입으로 투자금을 회수하는 데 걸리는 기간을 계산합니다.

연도 1
연도 2
연도 3
연도 4
연도 5

자주 묻는 질문

코드 구현

def payback_period(initial_investment, cash_flows):
    """
    Returns simple payback period in years.
    cash_flows: list of annual cash inflows
    """
    cumulative = 0
    for year, cf in enumerate(cash_flows, start=1):
        cumulative += cf
        if cumulative >= initial_investment:
            # Interpolate for exact fractional year
            overshoot = cumulative - initial_investment
            return year - overshoot / cf
    return None  # Not recovered within given cash flows

# Example
initial_investment = 50000
cash_flows = [10000, 15000, 18000, 20000, 22000]

period = payback_period(initial_investment, cash_flows)
if period:
    print(f"Payback Period: {period:.2f} years")
else:
    print("Investment not recovered in the given period")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.