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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -