{"id":3475,"date":"2023-09-10T10:00:18","date_gmt":"2023-09-10T01:00:18","guid":{"rendered":"https:\/\/blue-bear.jp\/kb\/?p=3475"},"modified":"2023-09-10T10:00:20","modified_gmt":"2023-09-10T01:00:20","slug":"python%e5%85%83%e5%88%a9%e5%9d%87%e7%ad%89%e8%bf%94%e6%b8%88%e9%a1%8d%e3%82%92%e8%a8%88%e7%ae%97%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/python%e5%85%83%e5%88%a9%e5%9d%87%e7%ad%89%e8%bf%94%e6%b8%88%e9%a1%8d%e3%82%92%e8%a8%88%e7%ae%97%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95\/","title":{"rendered":"[Python]\u5143\u5229\u5747\u7b49\u8fd4\u6e08\u984d\u3092\u8a08\u7b97\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>calculate_amortization_schedule\u95a2\u6570\u3092\u4f5c\u6210\u3057\u3001\u501f\u5165\u984d\u3001\u91d1\u5229\u3001\u8fd4\u6e08\u5e74\u6570\u3092\u5165\u308c\u308b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def calculate_amortization_schedule(principal, annual_interest_rate, loan_term_years):\n    # Convert annual interest rate to monthly rate and calculate number of payments\n    monthly_interest_rate = annual_interest_rate \/ 12 \/ 100\n    num_payments = loan_term_years * 12\n\n    # Calculate the monthly payment using the amortization formula\n    monthly_payment = (principal * monthly_interest_rate) \/ (1 - (1 + monthly_interest_rate)**-num_payments)\n    \n    amortization_schedule = &#91;]\n    remaining_balance = principal\n    \n    for _ in range(num_payments):\n        interest_payment = remaining_balance * monthly_interest_rate\n        principal_payment = monthly_payment - interest_payment\n        remaining_balance -= principal_payment\n        \n        amortization_schedule.append((principal_payment, interest_payment, remaining_balance))\n    \n    return amortization_schedule\n\n# Example usage\nprincipal_amount = 100000  # The initial loan amount\nannual_interest_rate = 5   # Annual interest rate in percentage\nloan_term_years = 10       # Loan term in years\n\nschedule = calculate_amortization_schedule(principal_amount, annual_interest_rate, loan_term_years)\n\n# Print the schedule\nfor index, (principal_payment, interest_payment, remaining_balance) in enumerate(schedule, start=1):\n    print(f\"Month {index}: Principal Payment = {principal_payment:.2f}, Interest Payment = {interest_payment:.2f}, Remaining Balance = {remaining_balance:.2f}\")\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>calculate_amortizati<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[500],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/3475"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=3475"}],"version-history":[{"count":1,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/3475\/revisions"}],"predecessor-version":[{"id":3476,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/3475\/revisions\/3476"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=3475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=3475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=3475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}