I am having an issue and would like some help, I'm very new to coding and programming (playing with Python 3 for little over a week and im having a blast) however today I have encountered an issue I cannot find a solution for, also my first time posting on here so apologies for any poor etiquette and poor formatting.
I am trying to work with the following:
user_weight = input("What is your weight? ")
Metric = input("(K)g or (L)bs: ")
if Metric == ("l" or "L"):
print(float(user_weight) / 2.2, "KGS") # used when weight is given in pounds
else:
print(float(user_weight) * 2.2, "PBS") # used when weight is given in kilograms
I made this just to practice which is why it isn't exactly useful or well designed, however when I run this in Pycharm I am encountering an issue. Simply I just want to be able to enter a value for "User_Weight" and then a string for "Metric" which will then be used to print out the converter value of weight between pounds and kilos just using the *2.2 and /2.2 values (1 kilo = 2.2 pounds) (if metric == upperL or lowerl) i want the first line to print, if it is any other string then I want the second line to print, however no matter what I type into the terminal for the second input (the one that defines Metric's parameters) only the first line of code will run. I'm not sure where I am going wrong, writing other If/else loops seem to run fine, I don't know if it is an issue with the If statement, the else statement or because I am using the "X or Y" bit. How can I edit this so that the if else statement reads the parameter of "metric" properly and will return the correct function based on what I have programmed it to do.
I have since learned of another way of making this program actually work but to satisfy my curiosity any explainations or advice on how to make this function in the way I have designed it would be greatly appreciated.
Regardless of the second user input defining the value of "metric" the if else loop seems to fail and the first line "print(float(user_weight) / 2.2, "KGS")" is always executed.