I am trying to write a program that calculates shipping costs for an imaginary courier and am trying to work with exception handling.
MetricOrImperial = input ("Are you using centimetres and kilograms or inches and pounds? (CK/IP)")
if MetricOrImperial == "CK":
dimensionsCW = input ("What is the width of your package?")
dimensionsCL = input ("What is the length of your package?")
dimensionsCH = input ("What is the height of your package?")
dimensionsW = int(dimensionsCW)/2.54
dimensionsL = int(dimensionsCL)/2.54
dimensionsH = int(dimensionsCH)/2.54
weightCK = input ("What is the weight of your package?")
weight = int(weightCK)/2.205
elif MetricOrImperial == "IP":
dimensionsW = input ("What is the width of your package?")
dimensionsL = input ("What is the length of your package?")
dimensionsH = input ("What is the height of your package?")
weight = input ("What is the weight of your package?")
elif MetricOrImperial != ("CK" or "IP"):
print ("You entered an incorrect response.")
shippingSpeed = input("What is your desired shipping speed in days? (Enter number between 1 - 5)")
In the exception handling I am trying to make the user go back to the first line ("MetricOrImperial") and restart the process, if the user has typed something that is neither "CK" nor "IP". The expected output is that it goes back to said line, but I'm not sure how to go about doing that.