You have got your indentations wrong, so the
elif
statements are not being recognised as connected to the previous
if
. It should be:
elif o == "7":
price=float(input("What was the original price of your purchase:"))
if price<0 :
print("Invalid input")
quit()
taxrate=float(input("What is the tax rate of your area (the tax rate of texas is 0.0625):"))
if taxrate>15:
print("Invalid input")
quit()
if taxrate<0:
print("Invalid input")
quit()
print("The additional tax is:")
tax=print(price*taxrate)
total=float(total=(tax+price))
print("Your total purchase is:")
print(total)
elif o == "8":
h=float(input("Enter your height in meters: "))
w=float(input("Enter your Weight in Kg: "))
BMI=w/(h*h)
print("BMI Calculated is: ",BMI)
if(BMI>0):
if(BMI<=16):
print("You are very underweight")
elif(BMI<=18.5):
print("You are underweight")
elif(BMI<=25):
print("Congrats! You are Healthy")
elif(BMI<=30):
print("You are overweight")
else:
print("You are very overweight")
else:
print("invalid input")
It would be better to write functions that handle each specific choice rather than coding everything inline as you have done.