14,173,165 members
See more:
```import house
def main():
determine_house()
determine_phone()
determine_car()
def determine_house(repeat):
house_price=float(input('Enter the price of the house you were going to pay'))
num_beds=int(input('Enter the number of bedrooms'))
house=house.house(house_price,num_beds)
foo=house.get_average_price()
woo=house.get_bedrooms()
if foo==218000:
if woo==2:
return ' You are paying average price for your house '
elif woo==1:
return ' You are being overpriced for this house relative to bedrooms '
determine_house(repeat-1)
else:
return ' you are getting a good deal for your house '
elif foo>218000:
return ' You are paying too much for a house in general '
else:
return ' You are getting a good price for this house in genereal  '
def determine_phone(repeat):
phone_price=float(input(' Enter the price of the phone you were going to pay '))
type_phone=input(' Enter the type of phone ')
phone=phone.house(phone_price,type_phone)
voo=phone.get_average_price()
coo=phone.get_type_of_phone()
if coo==' Android ':
if voo==254:
return ' you are paying average price '
elif voo>254:
return ' you are being overpriced '
determine_phone(repeat-1)
else:
return ' you are getting a good deal for this phone '
elif coo==' iphone ':
if voo==687:
return ' you are paying average price for this phone '
elif voo>687:
return ' you are being overpiced for this phone '
determine_phone(repeat-1)
else:
return ' you are getting a good deal for this phone '
else:
print('this type of phone is not supported by the engine')
def determine_car(repeat):
car_price=float(input(' Enter the price of the car you were going to pay '))
model=input('Enter the model of the car youre thinking of buying')
car=car.house(car_price,model)
boo=car.get_average_price()
loo=car.get_model()
if loo==' toyota camry ':
if boo==23947:
return ' you are paying average price for this car '
elif boo>23947:
return 'you are being overpriced for this car'
determine_car(repeat-1)
else:
return 'you are getting a good deal for this car'
elif loo==' Honda Accord ':
if boo==23720:
return ' you are paying average price for this car '
elif boo>23720:
return ' you are being overpiced for this car '
determine_car(repeat-1)
else:
return ' you are not getting a good deal for this house '
else:
return ' this model of car is not supported by the engine '

main()```

What I have tried:

ive tried putting the function calls at the bottom and top

```line 4, in main
determine_house()
UnboundLocalError: local variable 'determine_house' referenced before assignment```
Posted
Updated 15-May-19 6:58am
v2
Patrice T 15-May-19 12:48pm

Give exact error message and position.
Use Improve question to update your question.
James Rich443 15-May-19 12:50pm

line 4, in main
determine_house()
UnboundLocalError: local variable 'determine_house' referenced before assignment
James Rich443 15-May-19 13:19pm

now its telling me

determine_house()
TypeError: determine_house() missing 1 required positional argument: 'repeat' and its saying its expecting an indented block where each function is defined

## Solution 1

Quote:
It keeps saying my functions referenced before assignment.

This should be better:
```import house
def main():
determine_house()
determine_phone()
determine_car()
def determine_house(repeat):
house_price=float(input('Enter the price of the house you were going to pay'))
num_beds=int(input('Enter the number of bedrooms'))
house=house.house(house_price,num_beds)
foo=house.get_average_price()
woo=house.get_bedrooms()
if foo==218000:
if woo==2:
return ' You are paying average price for your house '
elif woo==1:
return ' You are being overpriced for this house relative to bedrooms '
determine_house(repeat-1)
else:
return ' you are getting a good deal for your house '
elif foo>218000:
return ' You are paying too much for a house in general '
else:
return ' You are getting a good price for this house in genereal  '
def determine_phone(repeat):
phone_price=float(input(' Enter the price of the phone you were going to pay '))
type_phone=input(' Enter the type of phone ')
phone=phone.house(phone_price,type_phone)
voo=phone.get_average_price()
coo=phone.get_type_of_phone()
if coo==' Android ':
if voo==254:
return ' you are paying average price '
elif voo>254:
return ' you are being overpriced '
determine_phone(repeat-1)
else:
return ' you are getting a good deal for this phone '
elif coo==' iphone ':
if voo==687:
return ' you are paying average price for this phone '
elif voo>687:
return ' you are being overpiced for this phone '
determine_phone(repeat-1)
else:
return ' you are getting a good deal for this phone '
else:
print('this type of phone is not supported by the engine')
def determine_car(repeat):
car_price=float(input(' Enter the price of the car you were going to pay '))
model=input('Enter the model of the car youre thinking of buying')
car=car.house(car_price,model)
boo=car.get_average_price()
loo=car.get_model()
if loo==' toyota camry ':
if boo==23947:
return ' you are paying average price for this car '
elif boo>23947:
return 'you are being overpriced for this car'
determine_car(repeat-1)
else:
return 'you are getting a good deal for this car'
elif loo==' Honda Accord ':
if boo==23720:
return ' you are paying average price for this car '
elif boo>23720:
return ' you are being overpiced for this car '
determine_car(repeat-1)
else:
return ' you are not getting a good deal for this house '
else:
return ' this model of car is not supported by the engine '

main()```

Quote:
now its telling me

determine_house()
TypeError: determine_house() missing 1 required positional argument: 'repeat' and its saying its expecting an indented block where each function is defined

```import house
def main():
determine_house() # it says there is a parameter missing between parenthesis
determine_phone()
determine_car()
def determine_house(repeat): # because here you say a parameter is requested```

So a solution is:
```import house
def main():
determine_house(1) # it says there is a parameter missing between parenthesis
determine_phone()
determine_car()
def determine_house(repeat): # because here you say a parameter is requested```

But the same message will pop for determine_phone() for exact same reason, and once you solved it, you will have the same on determine_car().

But the whole problem is that in your case, recursion is not what you need.
looks like you barely understand how the language works and large rewrite is in order for your code.
Advice: follow some tutorial to get familiar with usual aspects of the language like parameters of functions and behavior of return.
v2
James Rich443 15-May-19 13:14pm

now its telling me

determine_house()
TypeError: determine_house() missing 1 required positional argument: 'repeat' and its saying its expecting an indented block where each function is defined

Top Experts
Last 24hrsThis month
 OriginalGriff 260 TheRealSteveJudge 209 0x01AA 165 Gerry Schmitz 155 phil.o 135
 OriginalGriff 4,556 Richard MacCutchan 1,920 Patrice T 1,407 phil.o 1,208 Gerry Schmitz 1,187