Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Value Estimator Calculator
#1
Hello. I am working on value estimator in python. Towards the end of my script I am trying to create a rating systems based on the the total investment which = Repair_Cost + Sales price. I tried to def home_rating and then use if statements to no avail. The program works still but doesnt provide the final output I'm looking for. Thank you in advance for your help!

 
print("Welcome to Value Estimator")


Value_1 = int(input("Please enter the value of target home:"))

a1 = int(input("Please enter the value of the sales price of home #1:"))

a2 = int(input("Please enter the sales price of home #2:"))

a3 = int(input("Please enter the sales price of home #3:"))

a4 = int(input("Please enter the sales price of home #4:"))

a5 = int(input("Please enter the sales price of home #5:"))

avg_sales_price = (a1 + a2 + a3 + a4 + a5)/ 5

print("Average sales price for homes in area is", avg_sales_price)

ARV = str(avg_sales_price)

print("The ARV for this home:" + ARV)


def calc_repair_cost(Value_1):

    if Value_1 <= 30000:
        repair_cost = (60000) - (Value_1)
        
    elif Value_1 >= 30000:
        repair_cost = 20000
    return repair_cost

repair_cost = calc_repair_cost(Value_1)

print("The repair cost for the home is:", + repair_cost)

total_investment = Value_1 + repair_cost

def calc_home_rating(Value_1):

    if total_investment >= 60000:
        home_rating = False
    elif total_investment <= 60000:
        home_rating = True
    return home_rating 

home_rating = calc_home_rating

if (home_rating == True):
    print("This home is worth a look")
elif home_rating == False:
    print("This is not a good home") 
Reply
#2
Hello, after a quick glance I see 2 issues:

def calc_home_rating(Value_1): 
    if total_investment >= 60000:
        home_rating = False
    elif total_investment <= 60000:
        home_rating = True
    return home_rating 
You pass Value_1 to function, but it is never used in function's body.

home_rating = calc_home_rating
calc_home_rating is a function, so you need to call it with braces and argument
calc_home_rating(argument)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using ID3 Estimator for Decision Trees student6306 2 703 Jun-13-2023, 07:39 PM
Last Post: student6306
  Value Estimator Calculator getting a TypeError jaycuff13 2 2,538 Apr-01-2019, 09:40 AM
Last Post: jaycuff13

Forum Jump:

User Panel Messages

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