python 3.x - If statement within a function is skipped, despite conditions being fufilled -
i making miles km / km miles converter , when run converter skips on if statement when conditions appear fulfilled, , instead executes else statement.
here's code:
"""converts mi km.""" print("welcome converter!") miorkm = input("km mi, or mi km: ").lower val = input("how many km or mi: ") def converter(inpu2): """converts value.""" output = 0 if miorkm == "km": output = int(val) * 0.621 else: output = int(val) * 1.609 return output print(converter(miorkm)) any appreciated!
.lower should .lower(). returning function, != 'km'.
Comments
Post a Comment