HELP Please, Python Program Help

Joseph Roffey josephh.roffey at gmail.com
Sat Apr 10 06:57:12 EDT 2021


Hi, Im looking for some help with my program, I have been set a task to make a Strain Calculator. I need it to input two numbers, choosing either Metres or Inches for the 'Change in Length' divided by the 'Original Length' which can also be in Metres or Inches, the out put number also needs to give an option for the answer to be in metres or inches.

this is what i have come up with so far...


txt = "Strain Calculator"
x = txt.title()
print(x)

# This function divides two numbers
def divide(x, y):
	return x / y

print("Select operation.")
print("1.Strain")

while True:
    # Take input from the user
    choice = input("Enter choice(1): ")

    # Check if choice is one of the five options
    if choice in ('1'):
        num1 = float(input("Change in Length: "))
        num2 = float(input("Original Length: "))

        if choice == '1':
             print(num1, "/", num2, "=", divide(num1, num2)) 
        break
    else:
        print("Invalid Input")




More information about the Python-list mailing list