converter including multiple input(). :
def distance_converter():
print ('Please choose the value you wish to convert by entering the
relevant letter:')
intro=input('A) miles to km or km to miles B)cm to inch or inch to cm:')
if intro.upper() == ('A'):
A_ans1=input('would you like to convert miles or km? ')
if A_ans1.lower() == ('miles') or ('m'):
M_ans1 = input('please enter amount of miles: ')
y = float(M_ans1)*1.6 or int(M_ans1)*1.6
return 'the amount of km are: ' + str(round(y,2))
if A_ans1.lower() == ('km') or ('k'):
Km_ans1 = input('please enter amount of km: ')
x = float(Km_ans1)*0.62137 or int(Km_ans1)*0.62137
return 'the amount of miles are: ' + str(round(x,2))
if intro.upper() == ('B'):
B_ans1=input('would you like to convert cm or inch? ')
if B_ans1.lower == ('cm') or ('c'):
Cm_ans1 = input('please enter amount of cm: ')
t = float(Cm_ans1)/2.54 or int(Cm_ans1)/2.54
return 'the amount of inches are: ' + str(round(t,2))
if B_ans1.lower == ('inch') or ('i'):
Inch_ans1 = input('please enter amount of inch: ')
z = float(Inch_ans1)*2.54 or int(Inch_ans1)*2.54
return 'the amount of inches are: ' + str(round(z,2))
so the code works fine with the first input of A and B. Lets say I choose option A, it Doesn't matter what I input later, it always takes me to the miles converter. Same issue with cm and inches. Its like its not taking in to account the second "if" that will ask for a km input, always leads to the string of 'please enter amount of miles'. same issue with the B option and cm/inch. Thanks