Here is the code:
print("Welcome to the weight maintenance calculator!")
startWeight = float(input("Input your start weight, in kilograms: "))
height = float(input("Enter your height in centimetres: "))
sex = input("Enter your sex (M/F): ")
age = float(input("Enter your age: "))
dailyActivity = input("Rank your activity level, from 0-5: ")
if ((sex == "M") or (sex == "m")):
startWeightBmr = int((10 * startWeight) + (6.25 * height) - (5 * age) + 5)
if (dailyActivity == 0):
caloriesUsedCurrently = startWeightBmr + 300
print(caloriesUsedCurrently)
if (dailyActivity == 1):
caloriesUsedCurrently = startWeightBmr + 350
print(caloriesUsedCurrently)
if (dailyActivity == 2):
caloriesUsedCurrently = startWeightBmr + 400
print(caloriesUsedCurrently)
Anyway, if you run it, you'll see the issue quite clearly - no matter what number you put in (0, 1 or 2) for the dailyActivity variable, caloriesUsedCurrently is never printed. I'm wondering if there's something wrong with the if blocks, and whether or not they're being executed at all. Could someone please guide me on this one? It will run, so there's no error message, which makes it all the more confusing. Please help!
I tried running this in IDLE to see if it was VSCode that was the issue, but nope, as I suspected it was my code. Running it in IDLE did nothing.