Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Homework help
#1
A county collects property taxes on the assessment value of property, which is 60 percent
of the property’s actual value. For example, if an acre of land is valued at $10,000, its
assessment value is $6,000. The property tax is then 72¢ for each $100 of the assessment
value. The tax for the acre assessed at $6,000 will be $43.20. Write a program that asks for
the actual value of a piece of property and displays the assessment value and property tax.


The problem I am having with my property tax program is that is that it is not displaying the property tax it only shows the assessed value of the property and not the property tax.I am new to python, if anyone could help point out where i went wrong it would appreciated!

def prop(property_value):
    # calc the porperty assessment value
    assessmentvalue = property_value * .06
    print("the assessment value is ", format(assessmentvalue, ',.2f'))
def assessment(assessment_value):
    property_tax = assessment_value * .72
    print('the property tax is:', format(property_tax, ',.2f'))
def main():
    # ask for the properties actual value
    property_value = float(input("enter the properties actual value:"))
    prop(property_value)
    assessment(assessment_value)

main()
Reply
#2
The variable assessmentvalue defined in function prop() is not available outside this function (it is a *local* variable). If you want to use it outside the function, you can return its value
def prop(property_value):
    # calc the porperty assessment value
    value = property_value * .06
    print("the assessment value is ", format(value, ',.2f'))
    return value
Then in function main():
    assessmentvalue = prop(property_value)
I would be a good idea to name the functions accordingly to what they really do. For example prop() could be named display_assessment() and assessment() could be named display_tax()
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020