Oct-29-2017, 03:36 PM
to the particular error in your code (the first one) you should amend the code as follows
- first of all price method will return None if the volume of other house has bigger/same volume
- method name (price) is misleading. one would expect it to return/calculate price. more appropriate name should be used
- it's more logical to take as argument another house object, not side size
def price(self, otherSide): if otherSide**3 < self.volume(): return "The house is more expensive"however there are many flaws in your code. some of them:
- first of all price method will return None if the volume of other house has bigger/same volume
- method name (price) is misleading. one would expect it to return/calculate price. more appropriate name should be used
- it's more logical to take as argument another house object, not side size