基本 Python 函数和常量帮助

发布于 2024-09-26 21:34:39 字数 436 浏览 4 评论 0原文

我不知道从哪里开始这项作业:

在购买新房时,您必须考虑几个因素。在这个问题中,房屋的初始成本、估计的年度燃料成本和年税率都是可用的。编写一个程序,确定并显示五年后房屋的总成本,并针对以下每组数据执行该程序:

Initial House Cost  Annual Fuel Cost  Tax Rate
167,000             3,300             0.025
162,000             3,500             0.025
175,000             2,850             0.025

要计算房屋成本,请将初始成本添加到五年的燃料成本中,然后加上五年的税款。一年的税款是用税率乘以初始成本来计算的。显示实验室和讲座中讨论的程序测试。

任何有关编写初始函数和常量的帮助将不胜感激!

I'm not sure where to even start this assignment:

In shopping for a new house, you must consider several factors. In this problem the initial cost of the house, the estimated annual fuel costs, and the annual tax rate are available. Write a program that determines and displays the total cost of a house after a five-year period and execute the program for each of the following sets of data:

Initial House Cost  Annual Fuel Cost  Tax Rate
167,000             3,300             0.025
162,000             3,500             0.025
175,000             2,850             0.025

To calculate the house cost, add the initial cost to the fuel cost for five years, then add the taxes for five years. Taxes for one year are computed by multiplying the tax rate by the initial cost. Show testing for your program as discussed in lab and lecture.

Any help with writing the initial function and the constants would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

琴流音 2024-10-03 21:34:39

要计算房屋成本,请将初始成本添加

initial_cost

到五年的燃料成本中,

YEARS = 5
initial_cost + YEARS * annual_fuel_cost

然后添加五年的税金。一年的税款是用税率乘以初始成本来计算的。

initial_cost + YEARS * annual_fuel_cost + YEARS * initial_cost * tax_rate

To calculate the house cost, add the initial cost

initial_cost

to the fuel cost for five years,

YEARS = 5
initial_cost + YEARS * annual_fuel_cost

then add the taxes for five years. Taxes for one year are computed by multiplying the tax rate by the initial cost.

initial_cost + YEARS * annual_fuel_cost + YEARS * initial_cost * tax_rate
你的心境我的脸 2024-10-03 21:34:39

您应该首先阅读 python.org 上的基础知识。

然后,您只需对每个数据集执行 T=A+B*5+A*C*5 即可。

最后查阅您的实验和讲义,了解如何展示测试。

You should start by reading the basics at python.org.

Then you just do T=A+B*5+A*C*5 for each of your data sets.

Finally consult your lab and lecture notes to see how to show testing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文