Apr-10-2021, 01:49 PM
Thank you for your time, this would be perect if it had the choice of metres or inches and could calculate the answer to be in metres of inches, if you could implement this that would be amazing.
thank you
thank you
(Apr-10-2021, 01:11 PM)BashBedlam Wrote: Here is one way to go about it:
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 ()