【问题标题】:Getting a syntax error in Python and not sure why在 Python 中出现语法错误,但不确定原因
【发布时间】:2014-11-18 04:57:44
【问题描述】:

我正在尝试创建一个程序,询问一块财产的实际价值并显示评估价值和财产税。该县对财产的评估价值征收财产税,即财产实际价值的60%。评估值的每个$100 的财产税为$.72

对我做错了什么有什么建议吗?

#Create a program that asks for th actual value of a piece of property
# and display tge assessnebt value and property tax.
ASSESSED_VALUE = .60
PROPERTY_TAX=.72 *(ASSESSED_VALUE/ 100.00)

def main():
property_value = float(input('Enter property value: '))

def calcu_value(property_value)
assessed_value = property_value *assessed_value
property_tax = property_value * property_tax
# display totals of  
def display_calcu
print(property_value)
    format ('total_sales tax, '.2f'))
print(property_tax)
    format ('total_sales tax, '.2f'))

# Call the main function
main()

【问题讨论】:

  • 您遇到的错误的确切文本是什么?此外,您的缩进都搞砸了。请修复它。
  • 缩进不好?缺少函数定义的一半?缺少引号和冒号?

标签: python python-3.x syntax-error


【解决方案1】:

有很多语法问题。简化一点(我只是快速运行一下),试试这个:

#Create a program that asks for th actual value of a piece of property
# and display tge assessnebt value and property tax.
ASSESSED_VALUE = .60
PROPERTY_TAX=.72 *(ASSESSED_VALUE/ 100.00)

def main():
    property_value = float(input('Enter property value: '))
    assessed_value = property_value * ASSESSED_VALUE
    property_tax = property_value * PROPERTY_TAX

    print("Property value: {}".format(property_value))
    print("Property tax: {}".format(property_tax))
    print("Assessed value: {}".format(assessed_value))

# Call the main function
main()

至少运行没有错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-06-22
    • 2013-09-17
    • 1970-01-01
    • 2014-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多