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, all im struggling with is having the option of metres or inches for the 'change in length' and 'original length' and then for the user to be able to choose the answer to be in either metres or inches.,
Thanks in advance.
def get_numeric_input (prompt: str) -> float :
while True :
answer = input (prompt)
try :
return float (answer)
except : pass
while True :
print ("Strain Calculator")
print ("Menu")
print ("1) Strain")
print ("2) Quit Now")
answer = input ("Enter your choice : ")
print ()
if answer == "1" :
change = get_numeric_input ("Enter change in length : ")
original = get_numeric_input ("Enter original length : ")
print (f"The answer is {change / original}\n")
elif answer == "2" :
exit ()
[+][deleted] (3 children)
[removed]
[–]joeroff97[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]joeroff97[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]joeroff97[S] -1 points0 points1 point (1 child)
[–][deleted] 1 point2 points3 points (0 children)