2021-02-28

NameError: name 'mNewCal' is not defined issue

Im having some issue with my code. Im not really sure what's wrong with it. Thank you

if mNewCal or fNewCal < 1200:

NameError: name 'mNewCal' is not defined

sorry if the format is a little weird, stack overflow made it weird.

gender = int(input("enter your gender as a number from the following \n Male: 1 \n Female: 2 \n " ))
height = int(input("Please enter your height in inches: "))
age = int(input("Please enter your age: "))
weight = int(input("Enter your weight in lbs: "))
exercise = int(input("How much exercise do you do during the week (enter number) \n little to no: 1 \n light: 2 \n moderate: 3 \n heavy: 4 \n  "))
if gender == 1:
   mBMR = 66 + (6.3 * weight) + (12.9 * height) - (6.8 * age)
elif gender == 2:
    fBMR = 655 + (4.3 * weight) + (4.7 * height) - (4.7 * age)

if gender == 1:
    if exercise == 1:
        cal = mBMR * 1.2

    elif exercise == 2:
        cal = mBMR * 1.375

    elif exercise == 3:
        cal = mBMR * 1.55

    elif exercise == 4:
        cal = mBMR * 1.8

else:
    if exercise == 1:
        cal = fBMR * 1.2

    elif exercise == 2:
        cal = fBMR * 1.375

    elif exercise == 3:
        cal = fBMR * 1.55

    elif exercise == 4:
        cal = fBMR * 1.8



if gender == 1:
    mTotalCal = mBMR * 1.2
    #print(mTotalCal)

else:
    fTotalCal = fBMR * 1.2
   # print(fTotalCal)


looseWeight = str(input("do you want to loose weight? if yes, enter Y: \n if no enter N: \n "))

if looseWeight == "Y":
    yesWeight = int(input("How much weight do you want to loose (lbs) ? "))

else:
    print("thank you for using Nakul Industries health program!")


weeks = yesWeight
days = weeks * 7
months = days / 30


if gender == 1:
    mNewCal = mTotalCal - 500
else:
    fNewCal = fTotalCal - 500



if mNewCal or fNewCal < 1200:
    print("WARNING! your total intake will be less then 1200 calories, please consult a doctor before following this.")
    print("In order to lose " + yesWeight + " ,it will take " + weeks + " weeks " + "\n" + "or " + days + " days" + "\n or " + "approximately " + months + " months.")
else:
    print(
        "In order to lose " + yesWeight + " ,it will take " + weeks + " weeks " + "\n" + "or " + days + " days" + "\n or " + "approximately " + months + " months.")


from Recent Questions - Stack Overflow https://ift.tt/3uBCeOl
https://ift.tt/eA8V8J

No comments:

Post a Comment