首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在税务计算器中计算Python的错误

如何在税务计算器中计算Python的错误
EN

Stack Overflow用户
提问于 2018-07-23 10:30:51
回答 1查看 0关注 0票数 0

我试图用以下信息编写一个计算物业税的程序:

该税是使用评估价值计算的,即实际价值的60%。每100美元的评估价值,72美分被征税。例如,价值10,000美元的财产的分摊价值为6,000美元,总税务费用为43.20美元(6,000/100)*0.72)。

程序的目的是使用函数,因此,虽然下面的程序可能不一定需要函数,但它们是作为函数的介绍性实践而添加的。下面的代码是我想出的。由于无法识别的语法错误,它不会运行。空闲突出第三行,但没有提供其他信息。此代码可能包含几个语法和逻辑错误。

代码语言:txt
复制
def main():
    actual_value = float(input('Enter value of property: ')
    calc_assessed_value(actual_value)

def calc_assessed_value(number):
    assessed_val = float(number * (6 / 10))
    print('The assessed value is equal to 60% of the actual value.')
    print('The assessed value for this property is: ', assessed_val)
    calc_prop_tax(assessed_val)

def calc_prop_tax(number):
    tax_rate = float(0.72)
    prop_tax = float(number / 100 * tax_rate)
    print('The tax is 72 cents for every $100 of the assesed value.')
    print('The total property tax is: $', prop_tax)

main()
EN

Stack Overflow用户

发布于 2018-07-23 20:15:45

在第2行中添加一个括号:

代码语言:txt
复制
def main():
    actual_value = float(input('Enter value of property: '))
    calc_assessed_value(actual_value)

def calc_assessed_value(number):
    assessed_val = float(number * (6 / 10))
    print('The assessed value is equal to 60% of the actual value.')
    print('The assessed value for this property is: ', assessed_val)
    calc_prop_tax(assessed_val)

def calc_prop_tax(number):
    tax_rate = float(0.72)
    prop_tax = float(number / 100 * tax_rate)
    print('The tax is 72 cents for every $100 of the assesed value.')
    print('The total property tax is: $', prop_tax)

main()
票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100005649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档