Need substition for using label/goto -used in languages like C,..- in python
So basically, I am a newb at python (and honestly, programming).I have been experimenting with super basic stuff and have hit a "roadblock".
print("Hello User!")
print("Welcome to your BMI Calculator.")
print("Please choose your system of measurement (Answer in terms of A or B):")
print("A)Inches and Pounds")
print("B)Meters and Kilograms")
ans = str(input("Input:A or B"))
if ans =="B":
h = float(input("Please enter your height (in meters)"))
w = float(input("Please enter your weight (in kilograms)"))
bmi = w/(h**2)
print("Your BMI is:")
print(bmi)
if bmi < 18.5:
print("You are in the UNDERWEIGHT category.")
elif 18.5 < bmi <24.9:
print("You are in the HEALTHY-WEIGHT category.")
else:
print("You are in the OVERWEIGHT category.")
print("THANK YOU FOR YOUR TIME.")
elif ans =="A":
h = float(input("Please enter your height (in inches)"))
w = float(input("Please enter your weight (in pounds)"))
bmi = (w*0.453592)/((h*0.0254)**2)
print("Your BMI is:")
print(bmi)
if bmi < 18.5:
print("You are in the UNDERWEIGHT category.")
elif 18.5 < bmi <24.9:
print("You are in the HEALTHY-WEIGHT category.")
else:
print("You are in the OVERWEIGHT category.")
print("THANK YOU FOR YOUR TIME.")
else:
print("ERROR")
In the final else, I want it to go back to asking for input for the measurement system in case the user did not type 'A' or 'B' exactly. Some substitute for goto in python should work for that. Also, if there isn't a substitute for goto, the problem should be solved if it doesn't take any other input other than 'A' or 'B'. Thanks for your time.