Can someone please help fix this program? I'm pretty new in Python. Every time I run this program it says :
Traceback (most recent call last):
File "E:/Python/delin.py", line 38, in <module>
discounted_total = regular_total - full_discount
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
def find_discount(total):
if total <120:
discount = 0
else:
if total <300:
discount = 0.03*total
else:
if total <500:
discount = 0.05*total
else:
discount = 0.07*total
return discount
#---------------------------------------------------------------------------
#main program
beef = 8.49
pork = 6.12
chicken = 5.21
quantity_beef= input("How many pounds of beef were bought?")
quantity_pork = input("How many pounds of pork were bought")
quantity_chicken = input("How many pounds of chicken were bought?")
total_beef = beef * quantity_beef
total_pork = pork * quantity_pork
total_chicken = chicken * quantity_chicken
regular_total = total_beef + total_pork + total_chicken
full_discount = find_discount(regular_total)
discounted_total = regular_total - full_discount
print "The total is " + discounted_total
This is Python 2.7 btw.
Edit: also, the function on the top [find_discount(total)] has the normal indentations needed. But when posting this, the lines didn't indent