Hi, Im looking for some help with my program, I have been set a task to make a basic Strain Calculator.
I need it to input two numbers, one being the 'change in Length' and the other being 'Original Length'.
Both the 'Change in Length' and 'Original Length' must have the choice of either Metres or Inches. Then the calculator must divide the 'Change in Length' by the Original Length' and the answer must have the option for the user to display the answer in Metres or Inches.
I am really struggling with this as completely new to Python.
this is what I have come up with so far... If someone could amend this and please make it work that would be amazing.
Thanks in advance.
I need it to input two numbers, one being the 'change in Length' and the other being 'Original Length'.
Both the 'Change in Length' and 'Original Length' must have the choice of either Metres or Inches. Then the calculator must divide the 'Change in Length' by the Original Length' and the answer must have the option for the user to display the answer in Metres or Inches.
I am really struggling with this as completely new to Python.
this is what I have come up with so far... If someone could amend this and please make it work that would be amazing.
Thanks in advance.
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): ") 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")
Yoriz write Apr-10-2021, 11:59 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I added code tags for you but the indentation of the code is missing
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
I added code tags for you but the indentation of the code is missing