每月支出与储蓄
为了在纽约市安顿下来,您决定和一位朋友合租一套两居室公寓。您需要为房租、餐饮和娱乐做预算,同时每月预留一笔应急费用也是个好主意。应急预算可用于各种意外支出,比如添置衣物、电子产品或看病就医。
请按以下方式制定您的月度预算:
- 房租:$1200 / 月(含水电等杂费)
- 餐饮:$30 / 天(平均值,含买菜与外出就餐。)
- 娱乐:$200 / 月(电影、饮品、博物馆、聚会等)
- 应急费用:250 / 月(注意安全,别把手机摔了!)
在此应用中,假设每月平均为 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)))