始める無料で始める

毎月の支出と貯蓄

ニューヨークでやっていくために、友人と2ベッドルームのアパートをシェアすることにしました。家賃、食費、娯楽費を予算化する必要がありますが、毎月の不測の出費に備えて金額を割り当てておくのも良い考えです。不測の出費の予算は、新しい衣類や家電から病院の受診まで、幅広い用途に使えます。

毎月の予算を次のように設定します。

  • 家賃: 月あたり $1200(光熱費込み)
  • 食費: 1日あたり $30(平均。食料品と外食を含む)
  • 娯楽: 月あたり $200(映画、飲み物、美術館、パーティーなど)
  • 不測の出費: 月あたり 250(安全第一。スマホは落とさないように!)

このアプリケーションでは、1か月は平均30日と仮定します。毎月の支払い後に残った金額は、その月の貯蓄口座に回します。

前の演習で作成した monthly_takehome_salary が利用できます。

この演習はコースの一部です

Pythonで学ぶファイナンス入門

コースを見る

演習の手順

  • 毎月の支出を計算します。
  • 毎月の貯蓄(毎月の支払い後に残る金額)を計算します。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Enter your monthly rent
monthly_rent = ____

# Enter your daily food budget
daily_food_budget = ____

# Calculate your monthly food budget assuming 30 days per month
monthly_food_budget = ____

# Set your monthly entertainment budget
monthly_entertainment_budget = ____

# Allocate funds for unforeseen expenses, just in case
monthly_unforeseen_expenses = ____

# Next, calculate your total monthly expenses
monthly_expenses = ____
print("Monthly expenses: " + str(round(monthly_expenses, 2)))

# Finally, calculate your monthly take-home savings
monthly_savings = monthly_takehome_salary - ____
print("Monthly savings: " + str(round(monthly_savings, 2)))
コードを編集して実行