I'm quite new to Python, and am trying to make a simple unit converter - was hoping if anyone could tell me where i'm going wrong?
This is the script as it stands:
input('Would you like to convert centimeters to inches (a), or inches to centimeters (b)?\ntype a or b: ') if type('a'): dist_cent=float(input('measurement in centimeters: ')) print(dist_cent /2.54) elif type('b'): dist_inch=float(input('measurement in inches: ')) print(dist_inch *2.54)
If the user inputs 'a', the first 'if' works as it should. But if the user inputs 'b', instead of running the 'elif' statement, it runs the first 'if' statement as if the user had input 'a'.
Anybody able to explain this? Would be much appreciated.