#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    8
    Rep Power
    0

    Newbie- Simple question. stumped. Can anyone help someone who is trying this?


    def main():

    # Get Value of property
    property_value = float(input('Enter the property value: '))
    print('Property value is: $', format(property_value, ',.2f'))
    assessed_value(property_value)
    property_tax(assessed_value)

    # Calculate assessment value of property
    def assessed_value(property_value):
    assessed_value = property_value * .60
    print('Assessed value is: $', format(assessed_value, ',.2f'))

    # Display assessed value
    # Calculate taxes based on assessment value of property

    def property_tax(assessed_value):
    property_tax = assessed_value/100 * .64
    print('Property taxes: $', format(property_tax, ',.2f'))
    # Display property tax


    main()

    X
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,709
    Rep Power
    480
    Code:
    def main():
        property_value = float(input('Enter the property value: '))
        print('Property value is: $', format(property_value, ',.2f'))
        assessed_value(property_value)
        property_tax(assessed_value)  ########assessed_value is a function.
    A better way?
    Code:
    def assessed_value(property_value):
        # statements to Calculate assessment value of property
        return the assessed value
    
    def property_tax(assessed_value):
        # Calculate taxes based on assessment value of property
        return the property tax
    
    def main():
        property_value = float(input('Enter the property value: '))
        av = assessed_value(property_value)
        pt = property_tax(av) # property tax depends on the assessed value
    
        print('Property value is: ${}'.format(property_value, ',.2f')) # written like this eliminates the space between $ and the digits.
        print('Assessed value is: $'.format(av, ',.2f'))
        print('Property taxes: $'.format(pt))
    
    
    main()
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    8
    Rep Power
    0
    thanks!!!!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    8
    Rep Power
    0

    how do i add more functions and call them?


    def main ():

    #def gallons(square_feet):
    # Calculate hours of labor for job
    square_feet = float(input('Enter the square feet of space: '))
    gallons = square_feet / 115.0
    print('The number of gallons of paint required is: ', format(gallons, '.2f'))
    hours_of_labor = gallons * 8
    print('The total hours of labor required is: ', format(hours_of_labor, '.2f'))

    # Get price of paint per gallon
    price_per_gallon = float(input('Enter the price per gallon: '))
    paint_cost = gallons * price_per_gallon
    print('The total cost of paint is: $', format(paint_cost, ',.2f'))
    # calculate total cost of labor
    labor_cost = hours_of_labor * 20.00
    print('The total cost of labor is: $', format(labor_cost, ',.2f'))

    # calculate total cost of job including labor cost & cost of materials
    total_cost = labor_cost + paint_cost
    print('The total cost: $', format(total_cost, ',.2f'))

    # gallons()
    main ()
  8. #5
  9. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,709
    Rep Power
    480

IMN logo majestic logo threadwatch logo seochat tools logo